Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Where to start new Smarty

 
Post new topic   Reply to topic    Smarty Forum Index -> Frameworks
View previous topic :: View next topic  
Author Message
computerboy_
Smarty n00b


Joined: 09 Jul 2014
Posts: 2

PostPosted: Wed Jul 09, 2014 4:10 pm    Post subject: Where to start new Smarty Reply with quote

Hello!

I'm fairly new to Codeigniter and Smarty. I've been browsing internet for last couple of hours without finding answer to my question.

I have integrated Smarty 3.1.19 with the newest Codeigniter using this tutorial. When writing something to the "home.tpl" and accessing the controller via example.com/myproject/home blank page shows up.

There is maybe something I'm missing here, but should the $smarty = new Smarty be declared somewhere? How do I go on with the integration?

Codes below

Any help is greatly appreciated.

Home.php code:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller
{
    public function index()
    {

        $this->load->library( 'smartyci' );
        $this->smartyci->useCached( 'home.tpl' );
        $this->smartyci->display( 'home.tpl' );

    }
}


Smartyci.php:

Code:
<?php

if ( ! defined('BASEPATH') )
    exit( 'No direct script access allowed' );

require_once( 'application/third_party/Smarty-3.1.19/libs/Smarty.class.php' );

class Smartyci extends Smarty
{
    public function __construct()
    {
        parent::__construct();

        $config =& get_config();

        $this->caching = 1;
        $this->setTemplateDir( $config['application_dir'] . 'views' );
        $this->setCompileDir( $config['application_dir'] . 'third_party/Smarty-3.1.8/templates_c' );
        $this->setConfigDir( $config['application_dir'] . 'third_party/Smarty-3.1.8/configs' );
        $this->setCacheDir( $config['application_dir'] . 'cache' );
    }

    //if specified template is cached then display template and exit, otherwise, do nothing.
    public function useCached( $tpl, $cacheId = null )
    {
        if ( $this->isCached( $tpl, $cacheId ) )
        {
            $this->display( $tpl, $cacheId );
            exit();
        }
    }
}
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4673
Location: Hamburg / Germany

PostPosted: Wed Jul 09, 2014 10:28 pm    Post subject: Reply with quote

It can be permission problems.

run $this->smartyci->testInstall();
It will check the installation.
Back to top
View user's profile Send private message
computerboy_
Smarty n00b


Joined: 09 Jul 2014
Posts: 2

PostPosted: Thu Jul 10, 2014 8:00 am    Post subject: Reply with quote

It was a permission problem indeed. Thank you very much! So apparently "$this->load->library( 'smartyci' );"creates a new Smarty?.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Frameworks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP