I have categories table with > id,name,pcategory_id
I have created controller > categories_controller and created function
there
function showlist($id = 0) {
                $this->set('categories', $this->Category->find('all',
array('conditions' => array('Category.pcategory_id='.$id))));
        }

then created view/categories > showlist.ctp
<h1>Categories</h1>
<p><?php echo $html->link("Add Category", array('action'=>'add')); ?>
<table>

        <tr>
        <?php echo $this->element('showlist-dynamic',$categories);?>
        </tr>


</table>

then created the  view/element > showlist-dynamic.ctp
<ul>
<?php foreach ($categories as $cat): ?>
<li><?php echo $cat['Category']['name']; ?>
<?php
if(count($cat['ChildCategory'])>0)
{
        $categories=$this->requestAction('/categories/
showlist',array($cat['Category']['id']));
        echo $this->element('showlist-dynamic',$categories);
}
?>
</li>
<?php endforeach; ?>
</ul>

but its showing error finally, how to make the recusrion here
thanks in advance

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to