You are viewing revision #3 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.
or maybe this:
<img src="http://www.example.com/webapp/assets/123124de/widget/image.png" />
<img src="/webapp/assets/123124de/widget/image.png" />
$scripts = array( 'js/script1.js', 'js/script2.js' ); $assetFolder = Yii::app()->getAssetManager()->publish('assets'); $script = 'assetUrl = "' . $assetFolder . '";'; 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/'.