I'm a beginner in PHP and Silverstripe so I apologise if the question has a very simple answer.
I'm trying to get the last 8 items by date from a list of gigs and display them in reverse (ascending) order. here's my code:
//my php function
function Tour() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "GigDetail",
$filter = "",
$sort = "Date ASC",
$join = "",
$limit = "{$SQL_start},8"
);
return $doSet ? $doSet : false;
}
//my ss file
<% control Tour %>
<p>$Place - $Date.Nice - $Address <a href="$Link">more »</a></p>
<% end_control %>
This will show them in reverse order but from the bottom of the list. while I want to get the latest 8 gigs by date and display them in reverse order. Does it have anyting to do with $_GET['start'] ?
Thanks in advance
Mauro