Find in a list in an IF structure

From: Date: Thu, 28 Oct 2004 09:22:55 +0000
Subject: Find in a list in an IF structure
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11929@lists.php.net to get a copy of this message
Hello, my fellow mates in pain, hurry and frustration, What would you recommend for a better solution for my small Smarty problem? I have a fairly sophisticated class system where I generate forms on the fly using complex sets of templates. I have several {IF} cases where I have used multiple or's like this: <td valign= {if $fieldtypes[idx] eq "textarea" or $fieldtypes[idx] eq "radiogroup" or $fieldtypes[idx] eq "someother" } "top" {else} "middle" {/if}> {$fieldlabels[idx]}</td> <td> ... field generation goes here </td> etc... The above, of course, produces the correct valign attrbute for the various field labels. What I would like to use is a functionality like this: {if in_the_array($ftypes[idx], 'textarea,radiogroup,someother')} {else} {/if} You see what I am looking for, I suppose. So is there an internal function that might perform the "in_the_array" and return either true or false to the "if" structure? NB: I am NOT referring to the PHP in_array() function above. The "field types" are internal names. Or is it just too few hours of sleep that prevent me from finding the solution in the manual? Markku

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