I find very more posts about the problem, but all answers was unhelpful. For example Forcing Script Order from registerScript Method in Yii and yii CClientScript docs. Above posts had writen
registerScript(string $id, string $script, integer $position=NULL, array $htmlOptions=array ( ))
For getting above script:
<script type="text/javascript" id="some_id">
console.log("sasasasas");
//js code
</script>
I have piece of code:
$cs = Yii::app()->getClientScript();
$cs->registerScript(__CLASS__ . '#' . $this->id . 'Ex', '
console.log("sasasasas");'
//js code
, CClientScript::POS_READY, array('id="some_id"' )
);
But I could not get script like I expected. I got script without id="some_id".Could anybody can help me for find what I missed ?
EDIT
Does not work both versions:
$cs = Yii::app()->getClientScript();
$cs->registerScript(__CLASS__ . '#' . $this->id . 'Ex', '
console.log("sasasasas");'
//js code
, CClientScript::POS_READY, array('id'=> 'some_id' )
);
and
$cs = Yii::app()->getClientScript();
$cs->registerScript('some_id', '
console.log("sasasasas");'
//js code
, )
);