CodeIgniter Forums
If else in view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: If else in view (/thread-72790.html)



If else in view - Knutsford - 02-12-2019

I have added a new field in my controller

$output['ticket:types'][$key]['plus'] = "Yes"

or

$output['ticket:types'][$key]['plus'] = "No"


there is also an existing $output['ticket:types'][$key]['download


In the view there is


{if ticket:types}

                    {ticket:types}']

                   {dropdown}

                    {/ticket:types}
                  {else}
                        
                        <label>No ticket types available.</label><br />
                {/if}        
  {/if}




How do I test the value of $output['ticket:types'][$key]['plus']  in the view? I doesn't recognise {if plus == "Yes}


Thanks


RE: If else in view - php_rocs - 02-12-2019

@Knutsford,

Why don't you test the values before you send them to the view. Do a var_dump or use xdebug to see what is in the variable.


RE: If else in view - Knutsford - 02-12-2019

I want to test if it is Yes and then if it is then add a button


RE: If else in view - InsiteFX - 02-12-2019

if (output['ticket:types'][$key]['plus'] == "Yes")