-
☆ A M B ☆
- 450 Posts
Is there any way to ensure that my custom classes/functions are accessible from every snippet & plugin? I mean, aside from manually including something in every individual PHP element?
Is there a way to declare an additional global besides $modx that gets inserted into every cached snippet and plugin? Or add some custom methods to the $modx object? Or some equivalent of 'auto_prepend_file' from php.ini?
Is this an incredibly foolish question to be asking?
Not at all. I think that's exactly what $modx->getService() is for. It attaches the class to the $modx object:
http://rtfm.modx.com/display/revolution20/modX.getService
[ed. note: BobRay last edited this post 13 years, 5 months ago.]
-
☆ A M B ☆
- 450 Posts
Is there a way to set this up globally though - without having to specify it in every individual snippet and plugin?
I'm not even sure if this is the right approach for what I want to do any more - I'm just curious at this point.
I'm not sure what the best way would be. My first thought is a plugin tied to OnHandleRequest.