Re: section/array/isset problem
| From: | Linus McCabe | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: section/array/isset problem | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2551@lists.php.net to get a copy of this message | ||
This looks all fine at a first glance, are you sure you're assigning the
array properly in the php?
/l
On Sun, 20 Jan 2002 21:45:55 +0100 Kai Kramhoeft <kai@agentpark.de> wrote:
> Hi,
>
> I want to check if a variable is set. I am using the following line:
>
> {if isset($check_project[$projects[listing].id])}
>
> Smarty is complaining that this is not a valid command.
> Even
> {$check_project[$projects[listing].id]}
> is not working.
> $check_project is an array.
>
> Here is my code:
>
> {section name=listing loop=$projects}
> <tr>
> <td></td>
> <td class="regular"><input type="checkbox"
> name="project[{$projects[listing].id}]" value="{$projects[listing].id}"
> {if isset($project[$projects[listing].id])} checked {/if}>
> {$projects[listing].name}
> <input type="checkbox" name="check_project[{$projects[listing].id}]"
> value="{$projects[listing].id}"
> {if isset($check_project[$projects[listing].id])} checked {/if}>
> lalala {$check_project[$projects[listing].id]} lalala
> Freischalten </td>
> </tr>
> {/section}
>
> What am I doing wrong ? Thanks for your help,
>
> Kai
>