I'm working in a website where part of it I have the static html, so I created a layout and in it I'm inserting the static content using views. My problem is as this website has many pages I feel wrong creating an action for each url. So I implemented the controller below:
class PageController extends ControllerBase
{
public function initialize(){
$this->init();
$this->view->setLayout( 'website' );
}
public function indexAction ($url=''){
if($url == 'about')
$this->view->pick('page/about');
}
}
To load a template you should use
$this->view->setTemplateAfter('website');
instead of $this->view->setLayout( 'website' );
By using $this->view->pick('page/about');
you are overwriting the layout set by $this->view->setLayout( 'website' );
, resulting in only seeing the page/about
layout.