Davide wrote:
> unfortunly Router::connect() seems not to work for me. Cake
> 1.1.18. It's simply ignored. But you gave me a hint and using
> $Route->connect(...) I can achieve my goal.
>
> However I have to add a $Route->connect() for each action and it's not
> beautiful and subject to errors. I'm thinking in a workaround
> solution. I will post it here.

Worked a bit on it, but it took too much time for achieving a good
solution so I finally opted for mapping each action in routes.php and
managing the alias in the view action. So finally here is the code[1].

Now I'm asking myself about the utility of AppError if it's disabled
in a production environment. Can someone answer me maybe with a
scenario?

Thanks a lot.
Bye
Davide

1.

//routes.php
...
$Route->connect("/projects/",
array("controller"=>"projects","action"=>"index"));
$Route->connect("/projects/add/",
array("controller"=>"projects","action"=>"add"));
$Route->connect("/projects/delete/",
array("controller"=>"projects","action"=>"delete"));
$Route->connect("...
...
$Route->connect("/projects/view/",
array("controller"=>"projects","action"=>"view"));
$Route->connect("/projects/:alias",
array("controller"=>"projects","action"=>"view"));

//app/controllers/projects_controller.php
...
   function view($id=null){
      $data = null;
      if(empty($this->params["alias"]) && is_null($id)){
         $this->cakeError("error404",array($this->params["url"]));
      }else{
         if(!is_null($id)){
            $data = $this->Project->findById($id);
         }else{
            $data = $this->Project->findByAlias($this->params["alias"]);
         }
...


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to