Forum
Perch page functions
Hi, I would like to know if it is possible to access the page functions (i.e. perch_categories(), perch_collection() ) from admin.php inside my app.
Inside my admin.php i have:
$API->on('region.index', function(PerchSystemEvent $Event){
});
When the event fires, I am running a function which creates json files. This function includes some perch page functions to create the output. It seems that there is a problem and this will not work.
Is there a way to overcome this? My only other thought for now is to create a scheduled task for this but the preferred solution would be when the event fires.
Thank you
As the name suggests, page functions are for use on your pages - they're not available within the control panel environment.
They do all pretty much just proxy though to something that is available though.
What do you need to do?
What I am doing with the perch_categories() for example is that I am passing the catID to retrieve the catTitle.
Unfortunately I don't really understand your suggestion about what is available. Could you please explain what do you mean by this?
You can do something like this:
This worked just fine. I followed your example to do the same with PerchContent_Runway() and then get_collection(). Thank you very much for your help!