I used this:

http://bakery.cakephp.org/articles/view/tree-helper-1


My nav is an element with:

<div id="nav">
<?php
echo $tree->generate(
        $section_nodes,
        array(
                'element' => 'sections/nav_node',
                'model' => 'Section'
        )
);
?>
</div>

And nav_node.ctp looks like:

$tree->addItemAttribute('id', 'section_'.$data['Section']['id']);

if ($depth == 0)
{
        $tree->addItemAttribute('class', 'Section HideMe');
}

if ($hasChildren)
{
        $tree->addItemAttribute('class', 'NavParent');
}


$is_current = (isset($section_node_id) && $section_node_id ==
$data['Section']['id'])
        ? ' class="Current"'
        : null;
        
echo '<a href="'.$data['Section']['path'].'" title=""
rel="'.$data['Section']['id'].'"'.$is_current.'>'.$data['Section']['name'].'</a>';


On Sun, Jul 26, 2009 at 3:57 PM, Tony Thomas<truet...@gmail.com> wrote:
>
> I have a Pages table in my app with the following fields:
>
> id
> parent_id
> lft
> rght
> title
> body
> created
> modified
>
> My model uses $actsAs = array('Tree')
>
> All the data associations are correct and generatetreelist() returns
> the appropriate values. What I'm looking for is a way to turn the tree
> information into a nested list for dynamically built navigation. I
> want new pages to appear in the menu when they are created, but I want
> them to appear in the hierarchy according to where they fall in the
> tree.
>
> Does anyone have any tips for me?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to