My pages are built up using my own mvc so there are controllers and actions. The controller classes are auto loaded on demand.
Now what i am wanting to do is check if a action(which is a function) exists inside a class and if is does not my router is going to redirect the user to the error 404 page.
So here is a wee snip of what is going on:
$thisController = $this->controller."Controller";
$checkController = new $thisController;
if (method_exists($checkController, $this->action))
{
echo "true";
}
else
{
echo "False";
}
But because that controller is requred later on by the autoloader i get the following error message:
Warning: Missing argument 1 for Cabbit\ControllerAction::__construct(), called in /www/totodileparadise.com/html/Libraries/Router.class.php on line 49 and defined in /www/totodileparadise.com/html/Libraries/ControllerAction.class.php on line 10
Notice: Undefined variable: Cabbit in /www/totodileparadise.com/html/Libraries/ControllerAction.class.php on line 12
true
Fatal error: Cannot redeclare class albumsController in /www/totodileparadise.com/html/Application/Controllers/albumsController.php on line 61
So instead of calling the class i am hoping i can just read the contents of the class file for public functions and check for the existence of the function that way.