Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty 3 Installation Does not Work!!!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
qwerty_2013
Smarty n00b


Joined: 18 Nov 2011
Posts: 2

PostPosted: Fri Nov 18, 2011 1:04 pm    Post subject: Smarty 3 Installation Does not Work!!! Reply with quote

Hello! I have one problem during the installation:

Fatal error: Call to a member function createTemplate() on a non-object in C:\Program Files (x86)\PHP\Smarty\sysplugins\smarty_internal_templatebase.php on line 47

setup.php
Code:

require('Smarty.class.php');

class Smarty_cti extends Smarty
{
   function Smarty_cti()
   {
      function __construct()
         {
            parent::__construct();
            
           $this->template_dir = '/smarty/templates/';
           $this->compile_dir  = '/smarty/templates_c/';
           $this->config_dir   = '/smarty/configs/';
           $this->cache_dir    = '/smarty/cache/';
          
           //$this->caching = true;
           $this->assign('app_name', 'cti');
         }
   }
}


index.php
Code:

require('setup.php');


$smarty = new Smarty_cti();


$smarty->assign('name', 'Alex');
$smarty->display('index.tpl');

Please HELP me!!! What is wrong???

I use:
Smarty 3.1.5
PHP 5.2.13
Apache 2.2


Last edited by qwerty_2013 on Mon Nov 21, 2011 7:14 am; edited 1 time in total
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Fri Nov 18, 2011 1:31 pm    Post subject: Reply with quote

you don't have a problem with installation. You have a problem with »valid syntax, wrong thought«. Please have a very good look at the constructor of Smarty_cti (and then remove the PHP4-style constructor wrapping the PHP5-style constructor).
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


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

PostPosted: Fri Nov 18, 2011 2:42 pm    Post subject: Reply with quote

And it's now mandatory to use the setter methods to setup the directories

Code:

class Smarty_cti extends Smarty
{
      function __construct()
         {
            parent::__construct();
           
           $this->setTemplateDir( '/smarty/templates/');
           $this->setCompileDir( '/smarty/templates_c/');
           $this->setConfigDir( '/smarty/configs/');
           $this->setCacheDir('/smarty/cache/');
         
           //$this->caching = true;
           $this->assign('app_name', 'cti');
         }
}
Back to top
View user's profile Send private message
qwerty_2013
Smarty n00b


Joined: 18 Nov 2011
Posts: 2

PostPosted: Mon Nov 21, 2011 7:20 am    Post subject: Reply with quote

Thanks a lot! It's work now! But with some little changes: removed the first slash "/"

Code:

require('Smarty.class.php');

class Smarty_cti extends Smarty
{
   function __construct()
      {
         parent::__construct();
            
      $this->setTemplateDir('smarty/templates/');
      $this->setCompileDir('smarty/templates_c/');
      $this->setConfigDir('smarty/configs/');
      $this->setCacheDir('smarty/cache/');
      
      //$this->caching = true;
      $this->assign('app_name', 'cti');
      }
}


Last edited by qwerty_2013 on Tue Nov 22, 2011 4:36 am; edited 1 time in total
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon Nov 21, 2011 10:52 am    Post subject: Reply with quote

Ups, yes you are right. It was treated as an absolute path otherwise...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup 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