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

using templates from subdirectory

 
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 -> General
View previous topic :: View next topic  
Author Message
docstevie
Smarty n00b


Joined: 14 Jan 2004
Posts: 3

PostPosted: Wed Jan 14, 2004 2:59 pm    Post subject: using templates from subdirectory Reply with quote

hi,

i'm about to build a new website using smarty. there's one BIG problem i can't solve by my own (and searching the board didn't help too) that is:

the dir-structure looks like:

- my website
--- smarty
--- templates
--- subdir

when creating smarty-pages from the "my website"-dir, everything works fine, but i need to create smarty-pages from within "subdir" too. i either get the error "Warning: Smarty error: unable to read template resource..." or - when setting the template_dir to "../templates/" i get an empty page.

the template-path in the smarty.class.php-file is set to "templates".

what can i do to fix that? please help.

thank a lot, stevie.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Jan 14, 2004 3:06 pm    Post subject: Reply with quote

you can supply a full-path to the template in subdir:
$smarty->display('file:/full/path/to/subdir/foo.tpl');

note: you should prepend "file:" as resource-name before the path.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
docstevie
Smarty n00b


Joined: 14 Jan 2004
Posts: 3

PostPosted: Wed Jan 14, 2004 3:06 pm    Post subject: Reply with quote

just a little addition to that:

i tried to set the other dirs (compile_dir, plugins_dir, config_dir) also to the correct paths. now, the page is created, but all the link-paths and picture-paths are wrong.

so i guess the question would be: how can i make smarty think it is located in a different directory? so all the paths are correct again.

thanks, stevie.
Back to top
View user's profile Send private message
docstevie
Smarty n00b


Joined: 14 Jan 2004
Posts: 3

PostPosted: Thu Jan 15, 2004 2:37 am    Post subject: got it! Reply with quote

thanks for help... i finally solved the problem! was kinda simple html Wink but i also had to add some $_SERVER['DOCUMENT_ROOT']-vars at some places.
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 -> General 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