hi
-routes are like Controller/Action/Param/Param
-the 'index' is the default action
Take your 'Categories' structure and name it articles, so that the route
will be domain.ext/
then use the index() method. feed it with you article name's and convert
them to id to do your article management.
Something like that:
class ArticlesController extends AppController{
function index($name=null){
$row = $this->findAllByName($name);
$id = $row['id'];
//then get your article content
}
}
you'll need to convert your id to names for your links by using
findAllById($id). You need also to make sure that your article names are
uniques
and that your are using an appropriate way to pass special characters in
the url.
HTH
olivvv
gremlin 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
-~----------~----~----~----~------~----~------~--~---