InterJinn

Development Framework For PHP

Prioritizing Modules

There are sometimes components you will wish to have execute before anything else has a chance to load (excepting the dynamic loader service). A good example is a module responsible for tracking, or which perhaps invokes a service to do the tracking. Normally you might just include the module in you main template so that it is loaded on each page. The problem with this approach, especially for a tracking module, is that if a form has just been submitted successfully then normally a redirect will occur to a post form page. This redirect would occur before the component had a chance to load. To overcome this issue you can define priority modules which will be given an opportunity to load before any redirection may occur (unless a previous priority module made a redirect). The syntax for priority modules follows the same syntax as that used for loading modules in the Modules Documentation except that you will ommit the actual load via the dynamic loader object.

$GLOBALS['interJinn']['priorityModules']

Example:
$GLOBALS['interJinn']['priorityModules'] = array
(
    array
    (
        'logic' => array
        (
            array
            (
                'source' => 'InterJinn/tracking/tracking.inc',
            ),
        ),
    ),
);