Re: 'default' modifier

From: Date: Wed, 13 Jun 2001 14:13:04 +0000
Subject: Re: 'default' modifier
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-882@lists.php.net to get a copy of this message
an optional third parameter to assign might come in useful too $smarty->assign('foo',$bar,'default_val'); Mike Krus wrote: > > Andrei Zmievski wrote: > > > We'll take a look at this suggestion. > This is not related to the previous request, it might be a good idea also > > to have a function to set a default value for a variable within the > template. > > I know you can do {$foo|default:"bar"} but if you use $foo often > it get ugly. It also does not seem to work well in control structures... > > Being able to do {setdefault name=foo value="bar"} would assign the > value to $foo if it was unset or empty, and do nothing otherwise... > > Mike > > --- > 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/

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