cakephp 2 - load helper depending on layout -
cakephp 2 - load helper depending on layout -
i load helpers depending on layouts. want this, id doesnt't work:
function beforerender(){ if (array_key_exists($this->request->action, $this->custom_layouts)){ public $helpers = array('html', 'form', 'session', 'menu1'); $this->layout = $this->custom_layouts[$this->action]; }else{ public $helpers = array( 'session', 'html' => array('classname' => 'twitterbootstrap.bootstraphtml'), 'form' => array('classname' => 'twitterbootstrap.bootstrapform'), 'paginator' => array('classname' => 'twitterbootstrap.bootstrappaginator'), 'menu1' ); $this->layout = 'default'; } }
thanks help regards
you cant juse declare public $helpers
within methods.
you need phone call php wants called:
$this->helpers[] = 'menu1'; $this->helpers['html'] = array('classname' => 'twitterbootstrap.bootstraphtml'); ...
cakephp layout helpers cakephp-2.2
Comments
Post a Comment