Hi,
This is the discussion thread for my ClientScript extension.
It allows you to write:
<?php $this->beginWidget('ext.ClientScript.RegisterScript'); ?>
<script>
//login dialog
$( "#loginDialog" ).click(function(){
return false;
});
</script>
<?php $this->endWidget(); ?>
Instead of:
<?php
Yii::app()->clientScript->registerScript(
'loginDialog',
' //login dialog
$( "#loginDialog" ).click(function(){
return false;
});' );
Why this is better? Because you don’t need to strip your javascript code from quotes and your IDE will highlight it.
Additional params:
<?php $this->beginWidget('ext.ClientScript.RegisterScript',array('id'=>'myJs','position'=> CClientScript::POS_END)); ?>
<script>
...
</script>
<?php $this->endWidget(); ?>
Notice that your code should start with <script> and end with </script>, and these lines (first and last line) will be automatically removed .So your script must start in next line after <script>.
Also for CSS:
<?php $this->beginWidget('ext.ClientScript.RegisterCSS',array('id'=>'myCss','media'=>'print')); ?>
<style>
h1 {
color: green;
}
</style>
<?php $this->endWidget(); ?>
[size="2"][color="#1c2837"]Instalation:[/color][/size]
[list=1][*]Download & UnZip 2940