Re: [SMARTY] Including different directories

From: Date: Fri, 26 Apr 2002 14:12:09 +0000
Subject: Re: [SMARTY] Including different directories
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3899@lists.php.net to get a copy of this message
Are you using windows? try this: $main = "file:/full/path/to/file.txt"; I also see you used a relative path "./path/name/foo.txt", that might be causing a problem too. Monte Obed Klein wrote:
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
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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