7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » position in front-end according to sortorder
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 362 Views |
-
position in front-end according to sortorder

26 February 2011 at 5:09am
Hi UC,
I'm using your SortableDataObject::add_sortable_many_many_relation(). Everything is working great. My question concerns the use in a template.
On my page i need to order the DataObjects according the Value of the SortOrder. I managed to do just that, but i like to think there's a nicer way to do so.
right now i'm using a lot of if - loops to place my DO's in a table. Now this table has a lot of combined fields so i have to build the table step-by-step ( rowspans , it's a table for a pedigree);
----------------------------------------------------------
<table >
<% control Stamboom %>
<tr>
<td rowspan="4">
<% control StamboomPugs %>
<% if SortOrder = "0" %>
<% if Titel %>
<span class="champtitel">$Titel</span>
<% else %>
<span> </span>
<% end_if %>
<% end_if %>
<% end_control %>
</td>
<td rowspan="4">
<% control StamboomPugs %>
<% if SortOrder = "0" %>
$KennelNaam <br />
($Color)
<% end_if %>
<% end_control %>
</td>
<td rowspan="2">
<% control StamboomPugs %>
<% if SortOrder = "2" %>
<% if Titel %>
<span class="champtitel">$Titel</span>
<% else %>
<span> </span>
<% end_if %>
<% end_if %>
<% end_control %>
</td>
<td rowspan="2">
<% control StamboomPugs %>
<% if SortOrder = "2" %>
$KennelNaam <br /> ($Color)
<% end_if %>
<% end_control %>
</td><td >
<% control StamboomPugs %>
<% if SortOrder = "6" %>
<% if Titel %>
<span class="champtitel">$Titel</span>
<% else %>
<span> </span>
<% end_if %>
<% end_if %>
<% end_control %>
</td>
<td>
<% control StamboomPugs %>
<% if SortOrder = "6" %>
$KennelNaam <br /> ($Color)
<% end_if %>
<% end_control %>
--------------------------------------------------------------
etc. you get the ideaIs there a way to do such a thing in a nicer way?
-
Re: position in front-end according to sortorder

26 February 2011 at 6:35am
The control block doesn't replicate the sort order that is specified in the backend? It should.
| 362 Views | ||
|
Page:
1
|
Go to Top |

