How to modify the Smartytemplate loding policy
| From: | luis | Date: | Tue, 25 Mar 2003 12:19:31 +0000 |
| Subject: | How to modify the Smartytemplate loding policy | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1017@lists.php.net to get a copy of this message | ||
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?
-----Original Message-----
From: luis [mailto:luis@fuegolabs.com]
Sent: Tuesday, March 25, 2003 9:15 AM
To: 'Jason Sweat'; aztek@box.sk
Cc: 'Smarty Dev'
Subject: RE: [SMARTY-DEV] Quick Question
Will this work with templates {included} in other templates too?
-----Original Message-----
From: Jason Sweat [mailto:sweatjejm@mchsi.com]
Sent: Monday, March 24, 2003 11:23 PM
To: luis; aztek@box.sk
Cc: 'Smarty Dev'
Subject: Re: [SMARTY-DEV] Quick Question
From: "luis" <luis@fuegolabs.com>
> Find and replace is not a nice option because it will force developers
> to remember to write an awful if statement for each display, it's just
> nasty.
>
> How can I do it extending the Smarty class?
Use the code Monte posted earlier:
class my_smarty extends smarty
{
function display($user, $tpl_file, $cache_id = null, $compile_id =
null)
{
if($this->template_exists("$user/$tpl_file")) {
parent::display("$user/$tpl_file")
}else{
parent::display($tpl_file);
}
}
}
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php