Skip to content

Instantly share code, notes, and snippets.

@dvidsilva
Created March 24, 2014 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvidsilva/9745531 to your computer and use it in GitHub Desktop.
Save dvidsilva/9745531 to your computer and use it in GitHub Desktop.
example on how to add js in a view
//here view code, mostly HTML with php snippets to insert variables
//...
//...
//block with JS code
<?php
<?php
Yii::app()->clientScript->registerScript('settings-script', <<<EOD
FB.Event.subscribe('edge.create', function(response) {
alert('You liked the URL: ' + response);
});
FB.Event.subscribe('edge.remove', function(response) {
alert('You liked Remove: ' + response);
});
EOD
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment