In my JavaScript (using jQuery) there are a whole set of PHP variables to which I need access. While I\'ve got it working by just producing the JavaScript file as a view, an
Try to do this that way:
$myVarList = array(
'nameOne'=>$valueFromAnotherVar,
'nameTwo'=>$object->coolValue,
'nameThree'=>$cat->hoursSleptToday()
);$json = addslashes(CJSON::encode($myVarList));
Yii::app()->clientScript->registerScript("myVarList", 'myVarList = jQuery.parseJSON("' . $json . '");');