Re: check existence of template file

From: Date: Sat, 28 Apr 2001 19:34:03 +0000
Subject: Re: check existence of template file
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-640@lists.php.net to get a copy of this message
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/ >

« previous php.smarty.general (#640) next »