Re: [SMARTY] Re: include_else?????
| From: | Alexander Pervak | Date: | Thu, 14 Nov 2002 11:57:52 +0000 |
| Subject: | Re: [SMARTY] Re: include_else????? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6431@lists.php.net to get a copy of this message | ||
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