You say you want a *list* of articles but then use an example with a
title, suggesting you want a route for a specific article. If it's the
latter, you can do:

Router::connect(
        '/view/:article_slug',
        array('controller' => 'articles', 'action' => 'view'),
        array(
                'article_slug' => '[\+\-_A-Za-z]+',
                'pass' => array('article_slug')
        )
);

That assumes each article has a slug. You'll want to use that, rather
than the actual title. Look at SluggableBehavior.

You can replace "view" with anything else. You could do, for instance:

Router::connect(
        '/articles/:article_slug',
        array('controller' => 'articles', 'action' => 'view'),
        array(
                'article_slug' => '[\+\-_A-Za-z]+',
                'pass' => array('article_slug')
        )
);

Though, if you do that, be sure to create routes--before this one--for
any other actions in ArticlesController.

On Wed, May 6, 2009 at 9:22 PM, Dcahrakos <chaosfl...@gmail.com> wrote:
>
> Hi,
>
> I am working on a website where i need to get a list of articles from
> a database, and the original url is something like
> http://localhost/articles/article/Article Title here
>
> what im trying to do is reroute it so I can access it with something
> like
> http://localhost/view/Title here
>
> but I cant seem to get the routing to work properly...what is the
> correct way to get this to work?
>
> Thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to