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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -