Re: [SMARTY] function alternate

From: Date: Thu, 02 May 2002 21:24:37 +0000
Subject: Re: [SMARTY] function alternate
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4011@lists.php.net to get a copy of this message
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.

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