Difference between #3 and #4 of
Send asset folder path to a javascript of a widget

Revision #4 has been created by sensorario on Sep 22, 2011, 7:52:12 AM with the memo:

Improve the wiki due to a comment suggestion
« previous (#3) next (#5) »


Title unchanged

Send asset folder path to a javascript of a widget

Category unchanged


Yii version unchanged

Tags unchanged

widgets, javasctipt, tutorial, assets, hack

Content changed

Yii::app()->getClientScript()->registerScript('_', $script, CClientScript::POS_HEAD);
foreach ($scripts as $file)
Yii::app()->getClientScript()->registerScriptFile($file, CClientScript::POS_END);

Now, in your script1.js, you can use the variable assetUrl. For example, if you do alert(assetUrl); you'll see the path of this assets, ıe. '/assets/234hn43/'.

To do this in more widgets or extensions, use unique javascript var name like <extensionName>AssetUrl.
4 0
Viewed: 24 949 times
Version: 1.1
Category: Tips
Written by: sensorario
Last updated by: sensorario
Created on: Sep 21, 2011
Last updated: 6 years ago
Update Article


View all history