Created
March 24, 2014 17:57
-
-
Save dvidsilva/9745531 to your computer and use it in GitHub Desktop.
example on how to add js in a view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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