Good morning,
I have a ProjectsController that works fine with the usual
add/edit/view/index.
I can successfully view a project with /projects/view/$id.
Each project has also a unique name, and I would like to refer to each
project even with a url like /projects/$name.
I thought about extending the AppError on the missingAction and do the
required operations (code in the "footer" of the mail).
requestAction retrieve successfully the project detail with the right
thtml but no layout is rendered.
How can I render the correct page without doing a redirect?
Another question: is it possible to specify a different ErrorHandler
for a controller? So it could be possible to avoid ugly
switch. Something like setting the errorHandler variable inside the
controller.
Thanks a lot
Davide
<?php
/*
* app/error.php
*/
class AppError extends ErrorHandler{
function missingAction($params){
switch($params["className"]){
case "ProjectsController":
loadModel("Project");
$model = new Project();
$data = $model->findByName($params["action"]);
echo
$this->requestAction("/projects/view/".$data["Project"]["id"],
array("return"));
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 "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---