Hi,
I know these type of questions has been asked many times. please excuse. I
have a category table with id, parent_id, name, slug.
so if i want the children of a particular category I do a find all with
conditions array('conditions' => array('Category.parent_id' => $id );
Now i want the children of a particular category where i don't know the id
of this particular category but only it's slug. I have done something like
the one given below and it works. But is there any other way to do this in
cake? or cake way of doing this?.Any link to learn about this more.
$conditions1[] = 'Category.parent_id IN (SELECT Category.id FROM categories
AS Category WHERE
Category.slug LIKE \'%'. $slug.'%\')';
$this->set('categories1', $this->Category->find('all',array('conditions'
=> $conditions,'order' => 'lft ASC')));
Thanks,
Isaac
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---