Hello all,
I’ m new to EE and i need to write an extension that adds a few lines of JavaScript to EVERY pages (even the system/login page), whatever the theme is.
I checked the available hooks and I did not find anything that could suit my needs :-(
Do you have any hint for me ?
Regards,
Luc
for the front-end pages of a site, I’d suggest making a module/plugin that could output the necessary javascript via a tag added by the programmer/designer of the site to a global header template:
includes/header template (for example):
<html>
<head>
<title>blah blah</title>
{exp:some_plugin:js_includes}
</head>I agree that an accessory like audiopleb mentioned is probably the best option for the control panel, I’m not aware of any hooks that would let you run code on every CP page. The login page will probably require a “hack” to the necessary view or core files, but should be fairly minor I’d think.
I checked how the Google Analitics extention works, and you must to add a tag in your templates to make it works. It is not very user friendly.
Do you know if there is a central place in the code where we can add a hook that will let an extension post process the generated HTML ?
Almost all of the open source project I know (Joomla, Drupal, Magento, PhpMyAdmin, PhpBB, vBulletin, Wordpress…) have this hook.
Luc
I don’t believe that exists in EE. People familiar with EE won’t be taken aback by having to include the required tag in their <head>… they actually might wonder how your product works if it “magically” inserts the required code, to be honest.
I finally found a way do it:
My extension installs a CI hook ($hook[‘display_override’) and it works perfectly.
And idea: Why not implement EE hooks that just maps CI hooks ?
Luc
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.