I'm not sure the best way to word this, but here goes:
I want to display my data results from a query in 2 rows preferably using css divs, but I'd take it in two table rows at this point.
Here's where I'm at right now. I have a simple function in the Page.php controller class that gets all the SponsorPage results:
function getSponsors() {
$sp = DataObject::get("SponsorPage", "", "", "", "");
return $sp;
}
Then I have the following in my template that displays the info:
<h1>Sponsors</h1>
<ul>
<% control getSponsors %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode">$MenuTitle</a></li>
<% end_control %>
</ul>
Being that you can't use the modulus operator from w/in templates in SS, how can I manipulate the data into two columns. I figure I have to do something in the Page controller class, but I don't even know where to start. I would like the code to produce either two divs like:
<div class="col float-left">
<h1>Sponsors</h1>
<ul>
<li><a href="data-model-questions/editpost/252268#">Campus Door</a></li>
<li><a href="data-model-questions/editpost/252268#">Engineer Your Life</a></li>
<li><a href="data-model-questions/editpost/252268#">Key Bank</a></li>
<li><a href="data-model-questions/editpost/252268#">Daemen College</a></li>
</ul>
</div>
<div class="col float-left">
<h1>Sponsors</h1>
<ul>
<li><a href="data-model-questions/editpost/252268#">Campus Door</a></li>
<li><a href="data-model-questions/editpost/252268#">Engineer Your Life</a></li>
<li><a href="data-model-questions/editpost/252268#">Key Bank</a></li>
<li><a href="data-model-questions/editpost/252268#">Daemen College</a></li>
</ul>
</div>
or a table like:
<h1>Sponsors</h1>
<table>
<tr><td><a href="data-model-questions/editpost/252268#">Campus Door</a></td>
<td><a href="data-model-questions/editpost/252268#">Engineer Your Life</a></td></tr>
<tr><td><a href="data-model-questions/editpost/252268#">Key Bank</a></td>
<td><a href="data-model-questions/editpost/252268#">Daemen College</a></td></tr>
</table>
Any help you could give would be very much appreciated. TY!