title: Changing layout of view in Joomla 2.5
body: <p>I know there are several similar topics around but I read and tried most of them but still can't figure out how to do this.</p>
  
  <p>I have a written a component in Joomla 2.5 and it works so far. I have different views and I can load the views using the controller.php. 
  One of the views shows a table out of my data base (data about teams). </p>
  
  <p>Now I'd like to have another layout of the same view which would display the data base table as a form so can change the content.</p>
  
  <p>That's the file structure:</p>
  
  <p>views/<br>
  - teams/<br>
  - - tmpl/<br>
  - - - default.php<br>
  - - - modify.php<br>
  - - view.html.php  </p>
  
  <p>That's out of the view.html.php file:</p>
  
  <pre><code>...
  // Overwriting JView display method
  function display($tpl = null) {
  
      ...
  
      $this-&gt;setLayout('modify');
      echo $this-&gt;getLayout();
      // Display the view
      parent::display($tpl);
  }
  </code></pre>
  
  <p>I tried different combinations of setLayout, $tpl = ..., default_modify.php, etc.
  but I always either get the default layout or some error like 'can't find layout modify'</p>
  
  <p>I load the site with .../index.php?option=com_test&amp;task=updateTeams</p>
  
  <p>And the controller.php looks like this:</p>
  
  <pre><code>function updateTeams(){
      $model = $this-&gt;getModel('teams');
      $view = $this-&gt;getView('teams','html');
      $view-&gt;setModel($model);
  
      $view-&gt;display();
  }
  </code></pre>