A really quick search of the group for "routing" came up with many examples, but all you need to do is put something like the following in your /app/config/routes.php:


$Route->connect('/articles/:param1', array('controller' => 'yourController', 'action' => 'yourAction'));
$Route->connect('/articles/:param1/:param2', array('controller' => 'yourController', 'action' => 'yourAction'));

Then you can access the data with $this->params['param1'] and $this->params['param2'].

Eric



On 10/31/06, gremlin <[EMAIL PROTECTED]> wrote:
>
> If I create a model with a relationship to itself ie a nested
> categories model with a belongs to and has many relationship I can
> easily enough get a set of nested categories data.
>
> The problem for me is that if I wish to reference the content related
> to that category I must either reference it directly or set a nesting
> depth limit on the parameters I pass via the url. More clearly I can't
> figure out how I could set a controller to read category information
> from an url that might have no parameters or 5 or 13 or any other
> number.
>
> Is there a way to take a structure like so :
> Categories
> ______________________
> id   -   parent_id   -   value
> ______________________
> 0   -   null            -   null
> 1   -  0                -   articles
> 2   -  0                -   files
> 3   -  1                -   programming
> 4   -  3                -   php
>
> etc..
>
> and represent the actual hierarchy in the url as parameters?
> domain.ext/
> domain.ext/articles
> domain.ext/articles/php
>
> particulary in the case where in the future I might want to add a
> sub-category to "php" thus making the url into
> domain.ext/articles/php/cake or similiar?
>
>
>
>
>


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

Reply via email to