Hi, i am trying to loop through one menu control [Menu(3)]. Within the loop i nested a custom control.
the result shoud look like this:
- item 1.$MenuTitle
item a. (item 1 $Top.Link)
item b. (item 1 $Top.Link)
item c. (item 1 $Top.Link)
- item 2.$MenuTitle
item a. (item 2 $Top.Link)
item b. (item 2 $Top.Link)
item c. (item 2 $Top.Link)
- item 3.$MenuTitle
item a. (item 3 $Top.Link)
item b. (item 3 $Top.Link)
item c. (item 3 $Top.Link)
- item 4.$MenuTitle
item a. (item 4 $Top.Link)
item b. (item 4 $Top.Link)
item c. (item 4 $Top.Link)
The Problem is, that you It will NOT return the additionally joined data (http://doc.silverstripe.org/doku.php?id=datamodel#joining)
How can i get the right Data?
P.S.There is another small thing: if you use s.t. like: $Top.Link/show/$ID you will have a double slash, because $Top.Link already contains one "/" (gesundheitswesen//show/6). How can i get rid of it?
Greetings, Carsten.
Template:
<div id="banner">
<div class="banner_top"> </div>
<div class="banner_inner">
<ul class="menu">
<% control Menu(3) %>
<li class="sublevel1">$MenuTitle
<ul>
<% control getFirmenforBanner %>
<li class="sublevel2">
<a href="$Top.Link/show/$ID">$Firmenname $URLSegment</a>
</li>
<% end_control %>
</li>
</ul>
</li>
<% end_control %>
</ul>
</div>
<div class="banner_end"> </div>
</div>
Page.php (model):
function getFirmenforBanner() {
// Tabelle + Where + Sort + JOIN + LIMIT
$firmen = DataObject::get("Stammdaten", "", "Stammdaten.Firmenname", "", "");
//Debug::show($firmen);
//die;
return $firmen;
}