Jump to content

Data output in Smarty


Recommended Posts

{if isset($sections) && $sections}
  {foreach from=$sections key=keySection item='section'}
    {if isset($section.hook) && $section.hook === $hook}
    {/if}
  {/foreach}
{/if}

do i need to check every time isset($section.hook) if it is a child already checked isset($sections)?

Link to comment
Share on other sites

35 minutes ago, pswork said:


{if isset($sections) && $sections}
  {foreach from=$sections key=keySection item='section'}
    {if isset($section.hook) && $section.hook === $hook}
    {/if}
  {/foreach}
{/if}

do i need to check every time isset($section.hook) if it is a child already checked isset($sections)?

The best practice is to do this. Unless your 100% sure that if $sections is set de sub variables are always filled.

If a variable is called which is not set a error will be displayed.

Edited by Crezzur (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...