Hi there,
I've created a module called 'view' which renders a bunch of data into a template. The templates get rendered by calling the function 'viewTemplate' within the page_controller of view and it gets passed a template ID through the urlParams['ID'] variable.
So to view a template, you'd go to the URL:
www.mysite.com/view/viewTemplate/1
Ive created a template called 'InvalidPage' which will get rendered if the user enters an ID that does not exist, which is easy because i just write that into the viewTemplate function.
What i was wondering is if there was a way to handle incorrect function calls with a default function. So if the user tried to browse to:
www.mysite.com/view/incorrectFunctionName/1
Which is a valid page, but an incorrect function, can i get it to render the 'InvalidPage' template?
should i do something like, create a __construct function for my view page_controller and loop through all the values returned by 'get_defined_functions()' and check them against the URL segment. Then if its not found, renderWith(array('InvalidPage)) ?
Any other suggestions?
Cheers.