Metodo = Template

1. apps/frontend/modules/contenuto/templates/mypageoneSuccess


<p>Page One</p>

2. apps/frontend/modules/contenuto/templates/mypagetwoSuccess


<p>Page Two</p>

3. apps/frontend/modules/contenuto/actions/actions.class.php


<?php

class contenutoActions extends sfActions // estende la classe Symfony
{
  public function executeMypageone() // crea l'indirizzo - contenuto/mypageone
  { 
        
  }// END function
  public function executeMypagetwo() // crea l'indirizzo - contenuto/mypagetwo
  {      
  }// END function
}// END class

Point the browser at:
– http://localhost/jobeet/web/contenuto/mypageone -> render Page One
– http://localhost/jobeet/web/contenuto/mypagetwo -> render Page Two

Render dal Controller – Evitare il Template

3. apps/frontend/modules/contenuto/actions/actions.class.php


<?php

class contenutoActions extends sfActions // estende la classe Symfony
{
  public function executeMypageone() // crea l'indirizzo - contenuto/mypageone
  { 
        return $this->renderText("<html><body>Hello, World!</body></html>");
  }// END function
  public function executeMypagetwo() // crea l'indirizzo - contenuto/mypagetwo
  {      
  }// END function
}// END class

Point the browser at:
– http://localhost/jobeet/web/contenuto/mypageone -> render Hello, World!

Usare un Template Diverso

3. apps/frontend/modules/contenuto/actions/actions.class.php


<?php

class contenutoActions extends sfActions // estende la classe Symfony
{
  public function executeMypageone() // crea l'indirizzo - contenuto/mypageone
  { 
        $this->setTemplate('mypagetwo'); // nome template senza il suffisso Success
  }// END function
  public function executeMypagetwo() // crea l'indirizzo - contenuto/mypagetwo
  {      
  }// END function
}// END class

Point the browser at:
– http://localhost/jobeet/web/contenuto/mypageone -> render Page Two

Reference:
http://symfony.com/legacy/doc/gentle-introduction/1_4/it/06-inside-the-controller-layer