Thursday, 15 March 2012

javascript - Creating Dynamic JS with Yii -


I am trying to add a Google map to my page with which to draw boundaries dynamically according to the variable.

I am confused about this thing that should tell me what should I do in this case. Asset files appear to be a way of loading certain fixed JSs to some pages, but the variables generated from the PHP side do not seem to have any way of creating JavaScript.

I think I should use the registerJs () , but it is not clear to clarify the code I have passed here generally because it is only full Java Does the script want to create a variable in the controller and assign the JavaScript code-string?

Help!

>

I like it (not with Google Maps , But with register js):

  $ script = "Javascript here, with your" $ phpvariables. "in this". "; $ This-> Register: ($ script, see :: POS_END);  

See: See POS_HEAD for head section.

:: POS_BEGIN For the right time after opening.

See: POS_END before correcting.

See: POS_READY to execute code on document created event. This will automatically register the jQuery.

See :: POS_LOAD will automatically register the jQuery to execute the code on the document load event.

This is a The file is in the file, and it uses class registers ().

Edit: Note that by using POS_LOAD and POS_READY, the method will automatically add jQuery The file will be registered and it is jquery (window) .log () or jQuery (document) .ready ().


No comments:

Post a Comment