Including different directories

From: Date: Fri, 26 Apr 2002 13:50:41 +0000
Subject: Including different directories
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3898@lists.php.net to get a copy of this message
Hi! I'm new to Smarty. I'm a german programmer (sorry for my bad English) and want to change my Site into a Smarty-powered site.Up to now I used TemplatePower, but it gives me some problems I hope are solved with smarty. Therefore this is a try. I hope you can give me a few hints and in effect turn me into a smarty- disciple! :-)) I've got a site which has dozens and hundreds of different pages (e.g Enzyclopedia, News Articles, etc.). All these different files simply contain Text and a few HTML and PHP Tags. To get everything in order I made different folders, of course. But now I have a problem. It looks like this: ---index.tpl--- <html> <body> {include file="$main"} </body> </html> ---/index.tpl--- So far, so good. This means that the main content needs to be changed constantly. I try to solve this like that: ---index.php--- <?php require_once("Smarty.class.php"); $smarty = new Smarty; if ($navid == "news") { $smarty -> assign("main","./path_to_newsfile/news.txt" ); } else { $smarty -> assign("main", "main.tpl"); } $smarty -> display("index.tpl"); ?> ---/index.php--- Everytime the navid changes, a different $main file should be called. But the above doesn't work, since smarty looks ONLY into the default templates- directory and it keeps telling me that it can't read news.txt. I'd appreciate if you could give me some assistance. Obed

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