Re: [SMARTY] advanced {include}
| From: | M Mohr | Date: | Fri, 07 Feb 2003 08:13:27 +0000 |
| Subject: | Re: [SMARTY] advanced {include} | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7568@lists.php.net to get a copy of this message | ||
Hello,
On Thu, Feb 06, 2003 at 07:32:21PM -0500, Greg Beaver wrote:
> Thanks, this is very helpful,
>
> Greg
just an additional thought: be careful to use different compile_dirs when
using different search-paths. otherwise smarty may get confused. smarty
names the compiled template after the original template.
for example:
d1/foo.tpl
d2/foo.tpl
with a search path of p1:p2 it will find the first foo.tpl
with a search path of p2:p1 if will find the second foo.tpl
but it will name the compiled template .../templates_c/foo.tpl in both
cases. this clashes.
additionaly: when you use caching, use different compile_ids for
different search-paths.
have fun
messju
> ----- Original Message -----
> From: "M Mohr" <messju@lammfellpuschen.de>
> To: "Greg Beaver" <greg@chiaraquartet.net>
> Cc: <smarty-general@lists.php.net>
> Sent: Thursday, February 06, 2003 5:36 PM
> Subject: Re: [SMARTY] advanced {include}
>
>
> > On Thu, Feb 06, 2003 at 01:48:46PM -0500, Greg Beaver wrote:
> > > Hi,
> > >
> > > For the schedule application at calendar.chiaraquartet.net, I need
> templates
> > > that have userlevel-aware include. Currently, all template data is
> stored
> > > ina mysql database, but I've decided to move that out to files so that I
> can
> > > take advantage of Smarty's compile abilities.
> > >
> > > I want to have {include} use a different include path for different
> > > userlevels. By this, I mean the {include} would first search in the
> > > userlevel include path, and if the template is not found, look in the
> > > default directory like this:
> > >
> > > {include file="my.tpl"}
> > >
> > > search for include_path/userlevel/my.tpl
> > > if not found
> > > search for include_path/default/my.tpl
> > >
> > > Is this already possible, or should I write my own extension for
> include?
> >
> > I don't think it is possible out of the box, but should be easy to do
> using
> > smarties default_template_handler_func:
> >
>
> http://smarty.lammfellpuschen.wg/manual/en/default.template.handler.function
> .php
> >
> > have fun
> > messju
> >
> > > Thanks,
> > > Greg