Re: I can't get in_array() to work

From: Date: Tue, 03 Jul 2001 16:34:27 +0000
Subject: Re: I can't get in_array() to work
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1106@lists.php.net to get a copy of this message
I've fixed this for the next release. Thanks for pointing it out. On Tue, 03 Jul 2001, Tomas Sanchez Romani wrote: > > > I'm having a problem when calling PHP's function 'in_array(item, > > > array)' > from inside a template: > > > > > > {section name="anl" loop=$anl_info} > > > ... > > *> <td class="textA{if in_array($anl_info[anl].typ, > $soek_typer)}{/if}">{$anl_info[anl].typ}</td> > > > > ^-------------------------------------------------^ > > > {/section} > > > > > *> The if statement compiles to: > > *> <?php > > *> if ( > > *> in_array ( $anl_info[anl].typ, > > *> $this->_tpl_vars['soek_typer']) > > *> ): > > *> ?> > > *> <?php endif; ?> > > *> > > *> but it should be, i think: > > *> <?php > > *> if ( > > *> in_array > > > $this->_tpl_vars['anl_info'][$_smarty_sections['anl']['properties']['index'] > ]['typ'], > > *> $this->_tpl_vars['soek_typer']) > > *> ): > > *> ?> > > *> <?php endif; ?> > > > > > > What can I do? because I really nedd to find out if this is true in some > way. > > > > Aren't you missing a ) right after $soek_typer? > > > > -Andrei > > Yes I'm missing that, but that was just a typo, now corrected an it gives > the same output. > " > *>" indicates corrected lines. > > regards, tomas > > ps. btw I'm only sending this to the list abd I would be very glad if your > responses only got > there to since I'm on it. > > > --- > You are currently subscribed to smarty as: andrei@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -Andrei * Life may be expensive, but it includes an annual free trip around the sun. *

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