I am working on a project where I have set up a habtm for Categories.
I am using CakePHP 1.3
The issue I am stuck is as under:
I have a post form, where I have a Milti Select box for categories, so
I can select all the categories that the post belongs to and post it.
It works fine and all the relevant entries goes to the correct tables
(posts, categories, categories_posts).
I am using Tree structure, so I have lft and rght set in the
categories table.
I have two types forms field in different forms which is to be
populated by $categories:
1. Dropdown - for creating new categories in system.
2. Multi-Select - for posts
and code of $controllers that I used is:
Dropdown: $this->Category->generatetreelist (null, '{n}.Category.id',
'{n}.Category.cat_name', '...');
This works fine and list is seem to be in hierarchy
But problem is when I use similar code of Posts form, the category
list is just in plain list without hierarchy. Code used for that is:
$categories = $this->Post->Category->generatetreelist (null,
'{n}.Category.id', '{n}.Category.cat_name', '...');
And in view:
echo $this->Form->input('Category.Category', array('label' =>
'Categories:', 'options' => $categories));
I want to get an hierarchical list of categories in the multi-select
field as set up in database. I tried many ways but no result.
Please advice.
Regards,
Thanks.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment