To include Javascript and CSS file in Yii, put the following at the top of your view file:
$cs=Yii::app()->clientScript;$baseUrl=Yii::app()->request->baseUrl;$cs->registerScriptFile($baseUrl."/javascriptfile.js");$cs->registerCssFile($baseUrl."/cssfile.css");
◄ #AskYii: How to include Javascript and CSS file in Yii Framework? | #Yii
June 26, 2013 · 729 views
To include Javascript and CSS file in Yii, put the following at the top of your view file:
Ross · 10 years ago$cs=Yii::app()->clientScript;
$baseUrl=Yii::app()->request->baseUrl;
$cs->registerScriptFile($baseUrl."/javascriptfile.js");
$cs->registerCssFile($baseUrl."/cssfile.css");
permalink · reply (0)
Related Posts
Object of class stdClass could not be converted to string error
#Yii Solution: Yii::app()->getBaseUrl() is returning empty string
#iamaWebDeveloper: I'm a freelance web developer, I can help you develop your web 2.0 site | #PHP #Yii #Bootstrap #Ajax #MySQL
#AskYii: Yii::app()->CreateUrl generates & instead of &. How can I fix this? | #Yii
#iamaWebDeveloper: i'll design and develop a site for you | #PHP #MySQL #Bootstrap #Yii
More in Yii
Object of class stdClass could not be converted to string error
#Yii Solution: Yii::app()->getBaseUrl() is returning empty string
How to enable #Gzip compression in Yii?
#Yii_tips: How to the get current page in CListView from partial rendering view?
#iamaWebDeveloper: I'm a freelance web developer, I can help you develop your web 2.0 site | #PHP #Yii #Bootstrap #Ajax #MySQL
#AskYii: Yii::app()->CreateUrl generates & instead of &. How can I fix this? | #Yii
#iamaWebDeveloper: i'll design and develop a site for you | #PHP #MySQL #Bootstrap #Yii
VICE.com - The Definitive Guide to Enlightening Information #Yii_Websites
RealSelf.com - Reviews of Cosmetic Treatments, Surgery, Doctors #Yii_Websites
Dizkover.com - Discover interesting stuffs online #Yii_Websites