Re: I can't get in_array() to work
| From: | Tomas Sanchez Romani | Date: | Tue, 03 Jul 2001 09:52:59 +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-1105@lists.php.net to get a copy of this message | ||
> > 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.