if this snippet in your js file , you should fetch it back from the view , but first you should hide it somewhere :
/**
* This is the shortcut to Yii::app()->request->baseUrl
* If the parameter is given, it will be returned and prefixed with the app baseUrl.
*/
function bu($url = null)
{
static $baseUrl;
if ($baseUrl === null)
$baseUrl = Yii::app()->getRequest()->getBaseUrl();
return $url === null ? $baseUrl : $baseUrl . '/' . ltrim($url, '/');
}
/**
* This is the shortcut to Yii::app()->theme->baseUrl
* If the parameter is given, it will be returned and prefixed with the app baseUrl.
*/
function tu($url = null)
{
static $baseUrl;
if ($baseUrl === null)
$baseUrl = Yii::app()->theme->getBaseUrl();
return $url === null ? $baseUrl : $baseUrl . '/' . ltrim($url, '/');
}
may be tu function is what you need :
// hide it some where , in js or html section:
var themeUrl = "<?php echo tu();?>" ;
// html:
<div id="themeUrl" title="<?php echo tu();?>"></div>
// then in your js file refer it : $("#themeUrl").attr("title");