10 January 2011 at 1:59pm
I have a product comparison chart which is built as a html table and has the services along the top and the features down the left hand side. There is a tick placed in the cell where the two meet if the feature is applicable to the service otherwise it is blank.
I have already created the data objects (Services and Features) and built the backend using DataObject Manager. There is a many to many relationship between these two objects.
What i want to know is how i can loop through the features and then tick the correct boxes. Below is some sample code.
<% control Features %>
// loop over global services here and inside each iteration, loop through the feature services array and check to see if id's match
<td class="normal-td "></td>
<% end_control %>
10 January 2011 at 2:58pm
I was thinking of going down the path of calling a method on the page class and just generating the html to pass back to the template. Either way, it requires some sort of intermediate php development and can't be achieved within the template alone.
29 August 2013 at 1:51am
Hi UC, thank you for this post (hope you still have it monitored) - it's so close to what i need - actually it does what i need except for one thing:
I'm using your Simple DataObject Translating (http://www.leftandmain.com/silverstripe-tips/2012/04/03/translatabledataobject-insanely-simple-translation/). When i try to do $T(Name) (using the $T function to translate, it does not generate any output.
I guess it has to do with the values beeing assigned as and array - but how can i fix it?