How about in one line?
In the app/config/routes.php file:

Router::connect('/projects/:id', array('action' => 'view'), array('id'
=> '[0-9]+'));

-J.


On Apr 28, 10:31 am, "Davide" <[EMAIL PROTECTED]> wrote:
> 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 cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to