Including template files in an app

  • Hi


    I have a template page that generates a pdf using mpdf library and several Perch collections.


    I now have made a little app that imports a csv to populate those collections. This works great.


    I have set up a schedule task with a function that fetches the page every 12 hours and therefore generates the pdf. This works fine as well.


    I now want to also fetch the page when the import is finished – so that a new pdf is regenerated from the new data.


    When I try to include the page in the app's form page I get the error: Fatal error: Uncaught Error: Call to undefined function perch_collection().


    I guess I can't access runtime functions from an app. So how can I do that? Or am I approaching this from the wrong direction :/? Answers on a postcard much appreciated…

  • Yeah, thanks hus_hmd, that's what I thought. I build the front-facing page first as the pdf generator was user-facing. However the query and pdf build is so slow I want to move it into the back end. I don't have the time / budget / will to live / left to work on this any longer so I will have to just rely on the scheduled task!