Re: [SMARTY] smarty directory organization

From: Date: Mon, 09 Sep 2002 07:37:31 +0000
Subject: Re: [SMARTY] smarty directory organization
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5955@lists.php.net to get a copy of this message
It looks like Smarty can't find the templates directory. Try removing the last / from $template_dir = '../../templates/'; Also instead of changing the Smarty.class.php file try extending Smarty. Here is an example. // Template object... require_once('Smarty/2.3.0/Smarty.class.php'); class Smarty_Extension extends Smarty { function Smarty_Extension() { global $path_to_website; parent::Smarty(); $this->template_dir = $path_to_website . '/templates'; $this->compile_dir = $path_to_website . '/templates_c'; $this->config_dir = ''; $this->plugins_dir = Array('plugins', '../plugins'); } } $smarty = new Smarty_Extension; // clear entire compile directory //$smarty->clear_compiled_tpl(); // clear the entire cache //$smarty->clear_all_cache(); Greetings, Jan Rosier * Nothing in life is to be feared. It is only to be understood. - Marie Curie * ----- Original Message ----- From: "Mark Chaney" <macscr@macscr.com> To: <smarty-general@lists.php.net> Sent: Saturday, September 07, 2002 2:57 PM Subject: [SMARTY] smarty directory organization > Im trying to organize the default directory setup of smarty and i cant seem > to get it to work. I have tried about everything. Here is the layout im > looking for: > > html/smarty/ > modules/ > smarty/ > cache/ > configs/ > docs/ > plugins/ > template_c/ > Config_File.class.php > debug.tpl > Smarty.class.php > Smarty_Compiler.class.php > templates/ > index.tpl > > here would be an example of the path to the Smarty.class.php file: > /home/virtual/site5/fst/var/www/html/smarty/modules/smarty/ > > so in the index.php file, i define things like this: > define > (SMARTY_DIR,'/home/virtual/site5/fst/var/www/html/smarty/modules/smarty/'); > require(SMARTY_DIR.'Smarty.class.php'); > > in the Smarty.class.php file i have things referenced like this: > // public vars > var $template_dir = '../../templates/'; // name of directory > for templates > var $compile_dir = 'templates_c'; // name of directory for > compiled templates > var $config_dir = 'configs'; // directory where config > files are located > var $plugins_dir = 'plugins'; // plugin directories > > > I have tried using absolute paths too and many other combinations, but i > cant seem to get things to work. Keep getting this as an error in one form > or another. All the proper chmoding has been done on the particular > directories that needed it. No ownership has been set because i set those > directories to 777. > > Warning: Smarty error: unable to read template resource: "index.tpl" > in /home/virtual/site5/fst/var/www/html/smarty/modules/smarty/Smarty.class.p > hp on line 589 > > > Hope someone has some ideas. > > Thanks, > Mark >

« previous php.smarty.general (#5955) next »