#AskYii: How to include Javascript and CSS file in Yii Framework? | #Yii


Updated July 12, 2013 ‚óŹ 714 views

I want to include Bootstrap files in my view. How can I include it using Yii Framework?

1 Comments

1

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");

Ross · 7 years ago
permalink · reply (0)

Our Terms of Use and Privacy Policy have changed.
By continuing to use this site, you are agreeing to the new Privacy Policy and Terms of Service.