Re: [SMARTY] function alternate
| From: | Ben Godfrey | Date: | Thu, 02 May 2002 21:48:41 +0000 |
| Subject: | Re: [SMARTY] function alternate | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4014@lists.php.net to get a copy of this message | ||
Yeah, I think that alternate would be a useful function, but you should definitely ditch 'val1' and 'val2', go for something more memorable, like 'car' and 'cdr' ;-)
Seriously though, something a teensy bit more descriptive like 'first' and 'second' would probably make it a bit more readable to template designers.
Ben Godfrey
On Thursday, May 2, 2002, at 10:31 PM, Monte Ohrt wrote:
Either that, or allow the hex value for the literal value of comma/quote. delimiter might make more sense for a template designer. I like it. Monte G wrote:Add a delimiter attribute :) Gerard-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-----Original Message----- From: Monte Ohrt [mailto:monte@ispi.net] Sent: Thursday, May 02, 2002 3:25 PM To: mark priatel Cc: 'Smarty' Subject: Re: [SMARTY] function alternate cycle is definately a more suited name for something that handles more than two values. {cycle values="#eeeeee,#d0d0d0,#ffffff"} I definately like the syntax better than var1, var2, ... Is it going to work OK for the vast majority using comma as a delimiter? alternate currently allows you to alternate without printing, much like you did where you don't advance when you print. either method works for two values, but three or more, your idea works better. Or maybe both ideas could be incorporated? Monte mark priatel wrote:Actually, I wrote a similar plugin a few days ago. {alternate} is definitely something that should be part of the smarty dist. My version was similar: - it accepts values as comma delim list, supporting more than 2 items - it allows the last value to be returned without advancing to the next value (useful for when you you have, say, colors alternating every 2 rows) - it can be reset I like how yours allows for nesting -- definitely something worth having. -mark-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc. -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php