I wrote a code (at the bottom) that in case of missingAction will search
in the database and if found then render the proper view.
Everything works fine except when I turn DEBUG=0 (production setup). Now
cake always render the 404 without entering the AppError::missingAction().
How can I do?
Following the code.
Bye and thanks
Davide
/*
* app/error.php
*/
class AppError extends ErrorHandler{
function missingAction($params){
switch($params["className"]){
case "ProjectsController":
loadModel("Project");
$model = new Project();
$data = $model->findByAlias($params["action"]);
if(is_null($data) || empty($data)){
parent::missingAction($params);
}else{
$this->controller->webroot = $params["webroot"];
$this->controller->set("content_for_layout",$this->requestAction("/projects/view/".$data["Project"]["id"],
array("return")));
$this->controller->pageTitle = $data["Project"]["name"];
$this->controller->viewPath = "layouts";
$this->controller->render("ajax");
}
break;
default:
parent::missingAction($params);
break;
}
}
}
--
Live life like you're gonna die. Because you're gonna.
William Shatner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---