Is there a safe place for common code used in logic hooks?


I need to write my first logic hooks.

These will need to store info from Suite in a separate database. The connection string in all the hooks will be the same.

So, is there a safe location in the file system for common code that can be included into the logic hooks, or do you just repeat the connection string in each hook.

Id prefer 1 location for something like that as it’s easier to move from dev/test to live environment.

What do others do?



I’d say you can have a PHP file under “custom” directory, and then do a “require_once” in every hook to include it. I’m no PHP expert, though, if someone knows of a better way, please go ahead…

With this, you can include code, classes, etc.

If you just need string maybe look into adding it to config_override.php as a global setting.