there is a model behavior called 'tree'. Have never used it but might
be worth taking a look.
On Aug 2, 12:48 pm, omeck <[EMAIL PROTECTED]> wrote:
> Hi,
> I have done menu with submenus. I used relations
> Menu hasMany Link
> Link belongsTo Menu
>
> I get data by $this->set('menusLeft', $this->Menu->findAll('page_pos =
> 1', '', 'Menu.pos ASC'));
> and display:
> <?php
> foreach ($menusRight as $menu) {
> echo '<div class="menuSep">' . $menu['Menu']['name'] . '</div>';
>
> foreach ($menu['Link'] as $link) {
> if ($link['new_window'] == 1)
> echo '<div class="menuLink">' .
> $html->link($link['name'], '/links/view/' . $link['url'], array('onclick' =>
>
> 'return!window.open(this.href)')).'</div>';
> else
> echo '<div class="menuLink">' .
> $html->link($link['name'], '/links/
> view/' . $link['url']).'</div>';
> }
> echo $menu['Menu']['code_block'];}
>
> ?>
>
> So I get:
>
> Menu1
> * submenu1
> * submenu2
> * sumbenu3
> Menu2
> * sumbenu5
> * submenu6
>
> etc.
>
> Today I decided that I need sumenus to submenus - submenus should have
> children. I added filed 'parent_id' to links table.
>
> My problem is how to prapare data?
> $this->Menu->findAll() and $this->Menu->Link->findAllThreaded() give
> me different results which a cannot( or i am not able to ;-)) use to
> build structure:
>
> Menu1
> *submenu1
> * submenu2
> * sumbenu3
> *submenu4
> * submenu5
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---