Hmmm,
Took a look at the page but don’t really know what to do with it :-(
If say I had a javascript in a folder on the server called my_script.js then how do I use that hook to attach the javascript? Also if creating this as an extension could I place the script in the same third_party folder as my extension?
Sorry for what is possibly a very dumb question but taking a look at that page didn’t give me much information. Please don’t get me wrong, I’m not blaming you 😉 rather the documentation.
Best wishes,
Mark
No worries, I’ve mostly figured out by trial and error and / or looking at other developers code.
Basically in the hook function you output the js, so this:
public function on_cp_js_end($data)
{
$html = 'alert("hello!");';
return $html;
}.. would produce an alert on each and every page.
You can put js code in /themes/third_party/<your_addon>/js/blabla.js and load it in some way I guess.
My best recommendation is to check out the source of some of the addons over on devot-ee and see how they used this hook:
http://devot-ee.com/hooks/ee/cp_js_end/
No worries, I’ve mostly figured out by trial and error and / or looking at other developers code. You can put js code in /themes/third_party/<your_addon>/js/blabla.js and load it in some way I guess.
Yep that’s exactly what I’m trying to do.
My best recommendation is to check out the source of some of the addons over on devot-ee and see how they used this hook: http://devot-ee.com/hooks/ee/cp_js_end/
Doing that now actually 😉
Thanks for the help on this.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.