문제

i would like to load helpers depending on layouts. i want something like this, but 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 for any help regards

도움이 되었습니까?

해결책

you cant juse declare public $helpers inside methods.

You need to call it as PHP wants it to be called:

$this->helpers[] = 'Menu1';
$this->helpers['Html'] = array('className' => 'TwitterBootstrap.BootstrapHtml');
...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top