0

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?

1 Answer 1

1

once you have the cocatenated $js, simply do...

<?php Yii::app()->clientScript->registerScript('myJS', $js); ?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.