How to include 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..
How to include 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..
u can just by adding
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/path/to/your/script');
Something like this:
<?php
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseUrl.'/js/yourscript.js');
$cs->registerCssFile($baseUrl.'/css/yourcss.css');
?>