|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kit Smarty n00b
Joined: 11 Feb 2019 Posts: 1
|
Posted: Mon Feb 11, 2019 10:37 am Post subject: isset in section |
|
|
After upgrading from 3.0.30 to 3.0.31 isset in sections produces notice.
PHP:
Code: | <?php
$data = array(
array('name' => 'John Smith', 'home' => '555-555-5555', 'cell' => '666-555-5555', 'email' => 'john@myexample.com'),
array('name' => 'Jack Jones', 'cell' => '888-555-5555', 'email' => 'jack@myexample.com'),
array('name' => 'Jane Munson', 'home' => '000-555-5555', 'cell' => '123456', 'email' => 'jane@myexample.com')
);
$smarty->assign('contacts', $data);
?> |
TEMPLATE:
Code: | {section name=customer loop=$contacts}
<p>
name: {$contacts[customer].name}<br />
{if isset($contacts[customer].home)}home: {$contacts[customer].home}<br />{/if}
cell: {$contacts[customer].cell}<br />
e-mail: {$contacts[customer].email}
</p>
{/section} |
OUTPUT:
Code: | Notice: Undefined index: home in ... |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|