I have written a php snippet that contains some php functions().
As of today I just included this snippet at the beginning of my Base Template:
Today I added $modx->sendErrorPage(); in my code and it turns out that my snippet is called one more time when loading the error_page.
The problem is my snippet contains php functions I get error messages when they are called more than once.
I know I could use if(!function_exists(myFunction)) to bypass the error messages but i think this is not a neat solution. I’d prefer my snippet to be executed only once at the beginning.
I tried to put my functions in a plugin on the OnHandleRequest event but this event is also called a second time when sending to error page.
Per chance would you have other solution for me ?