mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-05 15:54:07 +01:00
CClientScript::$scriptFilePosition and CClientScript::$scriptPosition for controlling default $position values for registerScriptFile and registerScript.
This commit is contained in:
@@ -160,6 +160,20 @@ class CClientScript extends CApplicationComponent
|
||||
* @since 1.1.3
|
||||
*/
|
||||
public $coreScriptPosition=self::POS_HEAD;
|
||||
/**
|
||||
* @var integer Where the scripts registered using {@link registerScriptFile} will be inserted in the page.
|
||||
* This can be one of the CClientScript::POS_* constants.
|
||||
* Defaults to CClientScript::POS_HEAD.
|
||||
* @since 1.1.11
|
||||
*/
|
||||
public $scriptFilePosition=self::POS_HEAD;
|
||||
/**
|
||||
* @var integer Where the scripts registered using {@link registerScript} will be inserted in the page.
|
||||
* This can be one of the CClientScript::POS_* constants.
|
||||
* Defaults to CClientScript::POS_READY.
|
||||
* @since 1.1.11
|
||||
*/
|
||||
public $scriptPosition=self::POS_READY;
|
||||
|
||||
private $_baseUrl;
|
||||
|
||||
@@ -577,8 +591,10 @@ class CClientScript extends CApplicationComponent
|
||||
* </ul>
|
||||
* @return CClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
|
||||
*/
|
||||
public function registerScriptFile($url,$position=self::POS_HEAD)
|
||||
public function registerScriptFile($url,$position=null)
|
||||
{
|
||||
if($position===null)
|
||||
$position=$this->scriptFilePosition;
|
||||
$this->hasScripts=true;
|
||||
$this->scriptFiles[$position][$url]=$url;
|
||||
$params=func_get_args();
|
||||
@@ -600,8 +616,10 @@ class CClientScript extends CApplicationComponent
|
||||
* </ul>
|
||||
* @return CClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
|
||||
*/
|
||||
public function registerScript($id,$script,$position=self::POS_READY)
|
||||
public function registerScript($id,$script,$position=null)
|
||||
{
|
||||
if($position===null)
|
||||
$position=$this->scriptPosition;
|
||||
$this->hasScripts=true;
|
||||
$this->scripts[$position][$id]=$script;
|
||||
if($position===self::POS_READY || $position===self::POS_LOAD)
|
||||
|
||||
Reference in New Issue
Block a user