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


Updated July 12, 2013 ● 764 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 · 11 years ago
permalink · reply (0)

This website uses cookies. By continuing to use this site, you are accepting our Privacy Policy and Terms of Service.