ethan
(Ethan)
August 20, 2010, 8:43pm
1
I publish JS files with the following code:
Yii::app()->clientScript->registerScriptFile(
Yii::app()->assetManager->publish(
Yii::getPathOfAlias('webroot').'/js/script.js'
)
);
Is there shortcut function for doing this in Yii?
tuga
(Tuga74)
August 21, 2010, 6:32pm
2
I publish JS files with the following code:
Yii::app()->clientScript->registerScriptFile(
Yii::app()->assetManager->publish(
Yii::getPathOfAlias('webroot').'/js/script.js'
)
);
Is there shortcut function for doing this in Yii?
I think you should not publish to the assets folder, you just need some folder in the root for the js files.
So using
Yii::app()->clientScript->registerScriptFile('/js/script.js');
is enough.
But I am no expert. Hope helped.
mikl
(Mike)
August 22, 2010, 9:04am
3
Yes, here it is
public function publishJs($file)
{
Yii::app()->clientScript->registerScriptFile(
Yii::app()->assetManager->publish( Yii::getPathOfAlias('webroot').$file);
);
}