
It’s been a while, but I’ve just hit this problem again and I know the proper solution now. I was right in saying that the snippet was being referenced twice, but that was a dumb thing to say because a search snippet is often referenced twice - perhaps once in a menu and once in the content of the results page. The solution is to check whether the function exists before declaring it. So, for every function, surround it with a function_exists call, like so:
if (!function_exists('TheFunction')) {
function TheFunction {
...
}
}
I’ve posted about it here too:
http://modxcms.com/forums/index.php?PHPSESSID=7cbbcac1ace4d6f9ab1b016372362893&topic=9332.msg%25msg_id%25
Also, after migrating my site to a different server, which uses a different version of PHP, I found that you can’t get away with declaring the functions at the end of the file without generating the following error:
Call to undefined function
The solution seemed to be to move the function declarations to the top. Note that whilst this solved the problem, I tried rolling back to reproduce the exact error, but it still seems to work despite using the old version. I’ve been getting odd caching behaviour ever since migrating so who knows?!
I’ve updated the download links in my first post to reflect the latest version I have.