Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

isset in section

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
kit
Smarty n00b


Joined: 11 Feb 2019
Posts: 1

PostPosted: Mon Feb 11, 2019 10:37 am    Post subject: isset in section Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP