The way you have it set at global its going to execute everywhere. You could change the hook location to only where you want it to execute or You could check for certain $variables that are only defined in certain sections of the site before you execute it, such as $threadinfo when viewing threads...etc. Or you could check the THIS_SCRIPT constant against what the constant is defined as in the file you want it executed. Theres a million or more ways to accomplish it. It would be easier to help you if you gave information about where your trying to get it to execute. There is no way to just say hey if I put this variable in this template thats when you need to execute the code to fill the variable.
|