Re: check existence of template file
| From: | Monte Ohrt | Date: | Sat, 28 Apr 2001 20:00:10 +0000 |
| Subject: | Re: check existence of template file | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-641@lists.php.net to get a copy of this message | ||
No, as it is not compatible with arbitrary template resources.
Joris Trooster wrote:
>
> I just addes the following function to Smart.class.php. Just what I need! Is
> it possible to add this to future versions?
>
> function check($tpl_file)
> {
> return file_exists(realpath($this->template_dir.'/'.$tpl_file));
> }
>
> Regards,
> Joris
>
> ----- Original Message -----
> From: "Monte Ohrt" <monte@ispi.net>
> To: "Joris Trooster" <trooster@interstroom.nl>
> Cc: <smarty@lists.ispi.net>
> Sent: Saturday, April 28, 2001 9:26 PM
> Subject: [smarty] Re: check existence of template file
>
> > That could probably be added, although not trivial with arbitrary
> > template resources.
> >
> > Joris Trooster wrote:
> > >
> > > Is there an easy way to check if a template file exists?
> > >
> > > Something like this:
> > >
> > > if ($template->check("templatefile.tpl")) {
> > > $template->display("templatefile.tpl");
> > > } else {
> > > $template->display("default.tpl");
> > > }
> > >
> > > Joris
> > >
> > > ---
> > > You are currently subscribed to smarty as: monte@ispi.net
> > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > Visit Smarty's homepage at
> > > http://www.phpinsider.com/php/code/Smarty/
> >
> > --
> > Monte Ohrt <monte@ispi.net>
> > http://www.ispi.net/
> >
> > ---
> > You are currently subscribed to smarty as: trooster@interstroom.nl
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at
> > http://www.phpinsider.com/php/code/Smarty/
> >
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/