pendalff / yii-csol
Implement Object Literal methods for client script Yii
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Type:yii-extension
This package is auto-updated.
Last update: 2024-11-07 05:39:50 UTC
README
Using objects for organize your client script code. The implementation of the basic methods Object Literal for framework Yii CClientScript.
Read more about this:
- Markup-based unobtrusive comprehensive DOM-ready execution
- Show love to the object literal
- Использование объектов для красивой структуры кода в JavaScript
Installation
Copy this component to extensions/yii-csol or add as submodule:
git submodule add git://github.com/smaknsk/yii-csol.git extensions/yii-csol
Add to protected/config/main.php
'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 ), )
API
YiiCSOL::registerScriptInit($module = null, $controller = null, $action = null, $position=self::POS_READY, $data = array())
Yii::app()->clientScript->registerScriptInit();
YiiCSOL::registerScriptData($name, $data)
Yii::app()->clientScript->registerScriptData();
YiiCSOL::registerCssFile($url, $media='')
Yii::app()->clientScript->registerCssFile();
YiiCSOL::registerScriptFile($url, $position = null, $isRevision = true)
Yii::app()->clientScript->registerScriptFile();
YiiCSOL::getRevision()
Yii::app()->clientScript->getRevision();