Hi Gremlin,

I'm surprised this topic is still open.

I would suggest:
1) get the passed args.
2) check if the last argument is an integer (if appropriate), if so the
last but 1 is the category to search on, else the last argument is the
category to search on.
3) for the category unbind all relationships except that for the parent
4) Set the recursive parameter on your category model appropriately
4) Find*All* categories named in step 2, and check that the parents
recursively to get the right one

Job done.

You could also do the search the otherway around (FindByParent_id)
again in a recursive loop, the choice should be made depending on what
is going to result in less SQL.

If you have vast numbers of categories I would recommend looking at
using MPTT tables to store them, becuase in that way you have the
possibility to get the right category in a single query. Something like
(cat.lft<subsubcat.lft, cat.rght>subsubcat.rght, subsubcat.name =
"Subcat"), with any other additional logic you would need, such as
checks on the intermediary categories, as appropriate.

AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :)
You may get your answer quicker by asking on the IRC Channel (you can
access it with just a browser here: http://irc.cakephp.org).

On Nov 2, 5:15 am, "gremlin" <[EMAIL PROTECTED]> wrote:
> > this shouldn't be a problem. you just need to split the args in the
> > categories index () function. You then build you complexity in there,
> > perhaps limiting your depth to 4 /cat/subcat/subsubcat/idThe limit is 
> > absolutely not an option. I think perhaps a arg count on
> the parameters could be used to set the recursive depth for the findall
> query on the parent category relationship though.
> 
> Anyone tell me if I am on the right track?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to