title: cakephp foreach loop condition
body: <p>i have this code in my admin_index view</p>
  
  <pre><code>&lt;?php foreach ($users as $user): ?&gt;
  &lt;tr&gt;
      &lt;?php if ( $user['User']['account_type']=='admin' ): ?&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td class="actions"&gt;
          &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
          &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
      &lt;/td&gt;
      &lt;?php else: ?&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td class="actions"&gt;
          &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
          &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
          &lt;?php echo $this-&gt;Form-&gt;postLink(__('Delete'), array('action' =&gt; 'admin_delete', $user['User']['ID']), array(), __('Are you sure you want to delete # %s?', $user['User']['ID'])); ?&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php endif; ?&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>what i'm trying to do is get the rows to print the actions td cell differently based on the account type *ergo if the account type is 'user' it will print a delete button and if 'admin, does not allow deleting.. now thing is one admin is a designated super user by the   'super_user' boolean column and i'm trying to integrate that into the if condition where if the currently logged in admin is the designated super user his own account row will not have the delete button similar to the code above but also be able to delete other admins.. and if the currently logged in user is not a super user the above code will be shown and the other admin cannot view the super users profile</p>
  
  <p>tried calling auth and session in the if statement with </p>
  
  <pre><code>this&gt;auth/session-&gt;user('ID')
  </code></pre>
  
  <p>that didn't really go well </p>
  
  <p>update</p>
  
  <pre><code>    &lt;?php foreach ($users as $user): ?&gt;
  &lt;tr&gt;
      &lt;?php if ( $this-&gt;Session-&gt;read('User.super_user')=== 1 ): ?&gt;
          &lt;?php if ( $this-&gt;Session-&gt;read('User.ID')===$user['User']['ID']): ?&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="actions"&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
              &lt;/td&gt;
          &lt;?php else: ?&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="actions"&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Form-&gt;postLink(__('Delete'), array('action' =&gt; 'admin_delete', $user['User']['ID']), array(), __('Are you sure you want to delete # %s?', $user['User']['ID'])); ?&gt;
              &lt;/td&gt;
          &lt;?php endif; ?&gt;
      &lt;?php else: ?&gt;
  
          &lt;?php if ($this-&gt;Session-&gt;read('User.ID')=== $user['User']['ID']): ?&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="actions"&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
              &lt;/td&gt;
          &lt;?php elseif ($user['User']['super_user'] ===1): ?&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="actions"&gt;
                  &lt;?php echo "no altering allowed";?&gt;
              &lt;/td&gt;
          &lt;?php else: ?&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['ID']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['username']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo h($user['User']['account_type']); ?&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td class="actions"&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('View'), array('action' =&gt; 'admin_view', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Html-&gt;link(__('Edit'), array('action' =&gt; 'admin_edit', $user['User']['ID'])); ?&gt;
                  &lt;?php echo $this-&gt;Form-&gt;postLink(__('Delete'), array('action' =&gt; 'admin_delete', $user['User']['ID']), array(), __('Are you sure you want to delete # %s?', $user['User']['ID'])); ?&gt;
              &lt;/td&gt;
          &lt;?php endif; ?&gt;
  &lt;?php endif; ?&gt;
      &lt;/tr&gt;
  </code></pre>
  
  
  
  <p>my issue now is from my first layer of if statements. its automatically ignoring my condition of checking if the session's current super_user is set to 1. it always goes with the else statement... dunno what's going on</p>