Wednesday, June 20, 2018

php - Include CSS,javascript file in Yii Framework




How to include a Javascript or CSS file in Yii Framework?



I want to create a page on my site that has a little Javascript application running, so I want to include .js and .css files in a specific view.


Answer



Something like this:



  $baseUrl = Yii::app()->baseUrl; 
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseUrl.'/js/yourscript.js');

$cs->registerCssFile($baseUrl.'/css/yourcss.css');
?>

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...