[geeklog-devel] New Plugin API for extending Header information

Blaine Lang geeklog at langfamily.ca
Sat Jun 28 09:46:44 EDT 2003


We now have PLG_getHeaderCode as a function that is called in
COM_siteHeader. Any plugins can now return information that will be added to
the header.thtml in the <HEAD>{plg_headercode}</HEAD> section.

Adding a check in your plugin function for the source of the script, can
ensure we are only adding the extra information when needed. This is great
to now easily and cleanly add JS functions but could be used to add other
Meta Tags.

Example of a plugin function
--- CODE BEGINS ---

/**
* Returns the items for this plugin that should appear on the main menu
*/
function plugin_getHeaderCode_fmpro()
{
    global $_CONF, $HTTP_SERVER_VARS;

    // Compare actual path to the plugin script that needs this extra
Javascript and header code
    // Sort out any differences in directory slashes
    $ENV_PATH = strtolower(str_replace('\\', '/',
$HTTP_SERVER_VARS['PATH_TRANSLATED']));
    $pluginscript = strtolower(str_replace('\\', '/',$_CONF['path_html'] .
'fmpro/index.php'));

    if ( $ENV_PATH == $pluginscript)   {
        return '<script src="include/TreeMenu.js" language="JavaScript"
type="text/javascript"></script>';
    }

}




More information about the geeklog-devel mailing list