Re: [PHP Template] Repeating values

From: Date: Wed, 01 Mar 2000 00:09:06 +0000
Subject: Re: [PHP Template] Repeating values
Groups: php.template 
Request: Send a blank email to php-template+get-258@lists.php.net to get a copy of this message
From: Andrei Zmievski <andrei@ispi.net> To: PHP Template Engine <php-template@lists.php.net> Subject: [PHP Template] Repeating values Date: Tue, 29 Feb 2000 08:47:29 -0600 Right now the spec mentions the following: * repeat = yes/no repeat the last value of the variable inside the section loop if the other variables have more values, if not specified, defaults to yes I'm wondering if it should be extended to allow either repeating of the last value the variable has, or of the default value. Example: {{ section sec1 }} {{ $foo default="green" repeat=yes }}, {{ $bar }} {{/section sec1 }} If $foo has 2 values ("red" and "blue"), and $bar has 4 values ("small", "medium", "large", "x-large"), then "blue" will be repeated: red, small blue, medium blue, large, blue, x-large
This may be confusing, because if the user expects that missing values will be covered by the "default=" attribute, then this behaviour will be counterintuitive.
If we specify repeat=default, though, it would do: red, small blue, medium green, large green, x-large
This is what I would expect if I am combining 2 variables, and one of the does not have the same number of elements than the other. Guess, we could make this more complex, and specified something like: $foo default=$foo:LAST and get the behaviour in the first part, but this can easily get out of hand, so I am not too keen about that. Just for pure speculation, one can also set up things so instead of a simple one to one correspondence between the lists, there is a combinatirial relation: red small red medium red large red x-large blue small blue medium blue large blue x-large Now that may be interesting.
Would this be a useful behavior or not? -Andrei Any sufficiently advanced Operating System is indistinguishable from Linux.
                              - Jim Dennis
===== Jesus M. Castagnetto - jcastagnetto@hotmail.com PalmPilot stuff & etc.: http://www.geocities.com/jm_castagnetto/ LAB: http://www.scripps.edu/research/metallo Metalloprotein DB: http://metallo.scripps.edu/ ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com

« previous php.template (#258) next »