// This function can have any name function AddMyScript($action) { // $action->script('path') puts in a script link // I recommend putting custom code in the local directory // like this $action->script(common_path('local/something.js')); // Otherwise you can add the full path, even server // $action->script('/full/path/to/script.js'); // return true means all is well return true; } // This is how you hook the 'EndShowScripts' event to run // your custom function, 'AddMyScript'. Event::addHandler('EndShowScripts', 'AddMyScript');