Implement Object Literal methods for client script Yii
Using objects for organize your client script code. The implementation of the basic methods Object Literal for framework Yii CClientScript., (*1)
Read more about this: * Markup-based unobtrusive comprehensive DOM-ready execution * Show love to the object literal * Использование объектов для красивой структуры кода в JavaScript, (*2)
Copy this component to extensions/yii-csol or add as submodule:, (*3)
git submodule add git://github.com/smaknsk/yii-csol.git extensions/yii-csol
Add to protected/config/main.php, (*4)
'components' => array( ... 'clientScript' => array( 'class' => 'ext.yii-csol.YiiCSOL', 'revisionFile' => 'clienscript.rev', 'coreScriptPosition' => CClientScript::POS_END, // At will. Required Yii >= 1.1.11 'defaultScriptFilePosition' => CClientScript::POS_END // At will. Required Yii >= 1.1.11 ), )
Yii::app()->clientScript->registerScriptInit();
Yii::app()->clientScript->registerScriptData();
Yii::app()->clientScript->registerCssFile();
Yii::app()->clientScript->registerScriptFile();
Yii::app()->clientScript->getRevision();