RE: [SMARTY-DEV] Quick Question
| From: | boots | Date: | Wed, 26 Mar 2003 20:22:00 +0000 |
| Subject: | RE: [SMARTY-DEV] Quick Question | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1032@lists.php.net to get a copy of this message | ||
luis:
------------------
Well, I can answer myself, no. If I have
display('foo.tpl');
and foo.tpl {includes file='header.tpl'}
I need to look BOTH for foo.tpl and header.tpl in templates/$user
and if they are not found there in templates/ If I redefine fetch then
foo.tpl can be checked but fetch is not called for the included
header.tpl template. Ideas?
------------------
Well, to add just a little bit more to this thread... instead of
overriding smarty's internal functions, you might be able to do the
following.
1) extend Smarty as per Monte's suggestion, overriding the default
smarty->Display. In the new Display code, also add a smarty assign
statement such as:
$this->assign('_tpl_path', $tpl_path);
where $tpl_path is either blank ("") or the user path to the file (ie.
$user.'/' as appropriate)
In your templates, you would include files like this:
{include file=$
_tpl_pathheader.tpl}
This definately works, though, unfortunately, you have to change your
template code slightly. The nice thing, is that this prevents Smarty
from having to search paths on every invocation of a template.
It may not be a bad idea to create a custom function in this case.
Currently, {include} does NOT work the way you want it to and the way
you want it to work DEFINATELY is not in line with the current design.
Therefore, a custom function seems appropriate. Then again, I like the
assign approach :)
just my 2c.
xo boots
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com