Re: [SMARTY] Re: include_else?????

From: Date: Thu, 14 Nov 2002 13:21:37 +0000
Subject: Re: [SMARTY] Re: include_else?????
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6434@lists.php.net to get a copy of this message
Here's your solution ;-) The smarty class has a default template handler function. This function is executed if a template isn't found. Just search the Smarty Docs for default_template_handler_func. You should find it. Have fun, Andre "Alexander Pervak" <shura@ukrsat.com> schrieb im Newsbeitrag news:1779362392.20021114135752@ukrsat.com... > Hello André, > > Thanks for your answer. I'd modified it like that. > > {if @file_exists("templates/" . $TemplateFile)} > {include file=$TemplateFile} > {else} > {include file="error.tpl"} > {/if} > > BUT! Isn't this would be more usable > {include file=$TemplateFile errorfile="error.tpl"} > > and maybe it would be useful to assign some page to all error > requests, which would be loaded on non-specified errorfile includes. > > Thursday, November 14, 2002, 9:43:56 AM, you wrote: > > > AR> try to check if the file exists before including it > > AR> {if file_exists("path/to/my/template.tpl")} > AR> {include file="path/to/my/template.tpl"} > AR> {else} > AR> Template not found > AR> {/if} > > > > > > AR> "Alexander Pervak" <shura@ukrsat.com> schrieb im Newsbeitrag > AR> news:11627704356.20021113183127@ukrsat.com... > >> Hi all! > >> > >> Is there some Smarty function like foreachelse which prevents errors > >> on including non-existing templates. It might be called includeelse > >> or something like that. > >> It's really useful function! I suprized with it absence. > >> > >> -- > >> Best regards, > >> Alexander > >> mailto:shura@ukrsat.com > >> > > > > > > > -- > Best regards, > Alexander mailto:shura@ukrsat.com >

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