He guys,
I have a dropdown menu and want to show some dataobject elements in the submenu in SS2.4, like this way:
=== Menu1 (Page) === Menu2 (Page) === Menu3 (Page)
------Submenu1 (menuelement extends DataObject)
------Submenu2 (menuelement extends DataObject)
class Menu1Page extends Page{
static $has_many = array( "Submenus" => "Submenu" );
[Code for the DataObject Manager]
}
class Submenu extends DataObject{
static $db = array(
"Title" => 'Varchar(255)'
);
}
html:
<ul>
<% control Menu(1) %>
<li>
<a href="$Link">Submenu</a>
<% if Children %>
<ul class="submenu">[ code for submenu ]</ul>
<% end_if %>
<% if Submenus %>
<% control Submenus %>
<ul class="submenu"><li>$Title</li></ul>
<% end_control %>
<% end_if %>
</li>
<% end_control %>
</ul>
I can´t figure out, how to get the DataObjects in that menu. I think you must set the dataobject in the menu-function, but I don´t know how.
Can anyone give me a hint?