|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
docstevie Smarty n00b
Joined: 14 Jan 2004 Posts: 3
|
Posted: Wed Jan 14, 2004 2:59 pm Post subject: using templates from subdirectory |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Jan 14, 2004 3:06 pm Post subject: |
|
|
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 |
|
docstevie Smarty n00b
Joined: 14 Jan 2004 Posts: 3
|
Posted: Wed Jan 14, 2004 3:06 pm Post subject: |
|
|
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 |
|
docstevie Smarty n00b
Joined: 14 Jan 2004 Posts: 3
|
Posted: Thu Jan 15, 2004 2:37 am Post subject: got it! |
|
|
thanks for help... i finally solved the problem! was kinda simple html but i also had to add some $_SERVER['DOCUMENT_ROOT']-vars at some places. |
|
Back to top |
|
|
|
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
|