Add Script / Register Script And Css


I’m using google’s jquery and using gvchart.I include it in site.layout.main file

is there any way to store this when the first time it loads and after that it takes all that stuff from that folder/file ?

i also used


bt it gives error.

$baseUrl = Yii::app()->baseUrl;

  $cs = Yii::app()->getClientScript();






if u have any link pls send



thank u :D


If you want to serve the file from your site, just download the relevant file, put it into a web accessible directory (such as www/js) and serve it as you would any local content.

Your user will still re-download the relevant files if they hit refresh, but it will be from your server rather than Google’s, which may or may not be beneficial.

thanx… it helped me so …

ok the next thing i want to ask is what is assetsManager->publish() ?? how to use it in our application ?

because it copies the main files or not.

It copies scripts from a protected location to a web accessible one. It’s intended to allow people to package up server and client scripts in one place rather than spread them across protected and web directories.

Did you already have a look at and

Those articles helped me a lot to understand and use the AssetManager.

thank you @keith and Jonas …it Helps a lot