Re: Conditional include

From: Date: Thu, 19 Jul 2001 13:28:28 +0000
Subject: Re: Conditional include
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1202@lists.php.net to get a copy of this message
Andreas Aderhold wrote: > > Hi there, > > I often include files conditionally like this: > > {if $T_WARNINGS} > {include file="formwarnings.html} > {/if} > > but that's a bit un-handy. Maybe there is a a general need to implement a > shorter syntax to conditionally include a file, e.g.: > > {include file="formwarnings.html" if=$T_WARNINGS} This would be fairly simple to implement. Any thoughts? I'm not sure about the attribute name. We could follow the {section} attribute syntax: {include file="formwarnings.html" show=$T_WARNINGS} > > even cooler but would be (but harder to implement, I guess): > > {if $T_WARNINGS include file="formwarnings.html /if} This breaks the syntax rules of the parser. You may as well do this: {if $T_WARNINGS}{include file="formwarnings.html"}{/if} Monte

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