Reputation: 11275
In my web-page my Javascript code looks like:
$js1 = <<< JS
function test1() {
}
JS;
$js2 = <<< JS
function test2() {
}
JS;
$j3 = <<< JS
function test3() {
}
JS;
Using some kind of logic I want to concatenate Javascript like this:
if ($something == 1 ){
$js = $js1.$js2;
}
How can I do that properly with Yii rules?
Upvotes: 0
Views: 39
Reputation: 367
once you have the cocatenated $js, simply do...
<?php Yii::app()->clientScript->registerScript('myJS', $js); ?>
Upvotes: 1