Zitty Yam
Zitty Yam

Reputation: 135

Yii : How to change widget folder

when I use $this->widget('someWidget',array() } I need to put the in /protected/components folder.

What if I want to some of my Widget inside /protected/anotherFolder ?

Can i set up something to make the $this->widget() function find another folder without change the parameter inside $this->widget() ?

Upvotes: 1

Views: 73

Answers (2)

rzelek
rzelek

Reputation: 4023

You can do it in config like that:

return array(
    'aliases' => array(
            'bootstrap' => 'ext.bootstrap',
        ),
);

Upvotes: 1

Developerium
Developerium

Reputation: 7265

if you want to put it in anotherfolder, then you have to give it the full path to be able to use it like in controller:

 $this->widget('application.anotherFolder.someWidgetFolder.someWidgetClass' , $params);

or you can make an alias in config/main

Yii::setPathOfAlias('anotherFolder', dirname(__FILE__) . '/../anotherFolder/someWidgetFolder');

and make it like

 $this->widget('anotherFolder.someWidgetClass' , $params);    

Upvotes: 1

Related Questions