Limiting a macro call

If you need to develop a macro that does not modify data but only needs to be executed once per page, simply use a static variable in your class to indicate that it has already been loaded.

e.g.

namespace Macro;

class ExtensionName extends \SCHLIX\cmsMacro {

    static $already_loaded;

    /*
     * Run the macro
     * @global type $HTMLHeader
     * @param array|string $data
     * @param object $caller_object
     * @param string $caller_function
     * @param array $extra_info
     * @return bool
     */
    public function Run(&$data, $caller_object, $caller_function, $extra_info = NULL) {
        if (self::$loaded == true)
        {
            return;
        } else {
            // do your thing here
            self::$loaded = true;

        }
        ////
    }

}