tags:

views:

1521

answers:

2

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..

+2  A: 

u can just by adding

Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/path/to/your/script');

ysing
+6  A: 

Something like this:

<?php  
  $baseUrl = Yii::app()->baseUrl; 
  $cs = Yii::app()->getClientScript();
  $cs->registerScriptFile($baseUrl.'/js/yourscript.js');
  $cs->registerCssFile($baseUrl.'/css/yourcss.css');
?>
Alexander Hramov