title: cakephp foreach sort with titles
body: <p>Hello
  i'm started to learning cakephp framework.And just for start i wanted to write some simple game.</p>
  
  <p>I have user controller wited already (not finished but works :D) and now i started to write equipment. But i stuck at the moment i'm trying to sort foreach by type (helmet, armor, shield etc) and now script output table like this:</p>
  
  <pre><code>Id  Owner   Name                    Status  Type    Cost
  1    23      Krasnoludzka Salada     B       H       100
  2    23      Jakieś spodnie          B       L       10
  3    23      Zbroja                  B       A       123
  </code></pre>
  
  <p>But i wanna to make it like this:</p>
  
  <pre><code>Id  Owner   Name                    Status  Type    Cost
  Helmets:
  1    23      Krasnoludzka Salada     B       H       100
  4    23      Smocza Salada           B       H       100
  Legs:
  2    23      Jakieś spodnie          B       L       10
  Armors:
  3    23      Zbroja                  B       A       123
  </code></pre>
  
  <p>Mine equipments_controller.php:</p>
  
  <pre><code>&lt;?php
  class EquipmentsController extends AppController {
  
      var $name = 'Equipments';
      var $helpers = array('Html', 'Form');
  
      function index() {
          $this-&gt;set('equipments', $this-&gt;Equipment-&gt;find('all', array('conditions' =&gt; array('owner='.$this-&gt;Session-&gt;read('Auth.User.id'), 'status=\'B\''))));
          //$this-&gt;set('equipments', $this-&gt;Equipment-&gt;find('owner='.$this-&gt;Session-&gt;read('Auth.User.id')));
      }
  
      function view ($id = null) {
          $this-&gt;Equipment-&gt;id = $id;
          $owner = $this-&gt;Equipment-&gt;read('owner');
          if ($owner['Equipment']['owner']==$this-&gt;Session-&gt;read('Auth.User.id')) {
              $this-&gt;redirect(array('controller' =&gt; 'equipments', 'action' =&gt; 'index'));
              $this-&gt;Session-&gt;setFlash('To nie twój przedmiot!');
          } else {
          $this-&gt;set('equipment', $this-&gt;Equipment-&gt;read());
          }
      }
  
  }
  </code></pre>
  
  <p>And equipments/index.ctp:</p>
  
  <pre><code>&lt;!-- File: /app/views/news/index.ctp  (edit links added) --&gt;
  &lt;h1&gt;Plecak&lt;/h1&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Id&lt;/th&gt;
          &lt;th&gt;Owner&lt;/th&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Status&lt;/th&gt;
          &lt;th&gt;Type&lt;/th&gt;
          &lt;th&gt;Cost&lt;/th&gt;
      &lt;/tr&gt;
  
  &lt;!-- Here's where we loop through our $news array, printing out news info --&gt;
  
  &lt;?php foreach ($equipments as $equipment): ?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['id']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['owner']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['name']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['status'];?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['type']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $equipment['Equipment']['cost']; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php endforeach; ?&gt;
  
  &lt;/table&gt;
  </code></pre>
  
  <p>Can anyone help me?</p>