phpcode-snippetsmodxditto

ModX Evolution: ditto + phx code


I am trying to create XML from my pages using ditto snippet. I have ditto snippet with tpl to a chunk and in chunk I have this:

<tour_id>[+tour-terms:get_tourid+]</tour_id>

tour-terms is a template variable and get_tourid is php code (in snippet phx:get_tourid) to filter text stored in tv.

All export to xml works only if I have only one page (startID is folder with one page in it). For multiple pages xml page refuse to load (server error 500). I expect some conflict between internal phx of ditto and phx snippet.

Could not find any solution, please help.


Solution

  • Solved. Problem was in functions I had in snippets. They have to be wrap inside a !function_exists conditional block:

    if(!function_exists(rnCountRows)) { 
        function rnCountRows() { ... } 
    }
    

    in case they are run more then once on a page