Hi,
I'm new to SS so I'd appreciate any assistance!
I have a SQL Query to retrieve some sitetree records from a dataobject (which is created by a DailyTask).
The query returns 10 sitetree dataobjects selected through a join with the Top Ten dataobject.
I loop through those in the template.ss and wish to provide a link in the href to each one.
I would like to know the most efficient way to retrieve the url link for those dataobjects as $Link does not work (it aint a field on the dataobjectset).
function GetTopTen ($country) {
$sqlQuery = new SQLQuery();
$sqlQuery->select = array('*');
$sqlQuery->from = array("TopTen",
"FULL JOIN SiteTree ON TopTenPageID = SiteTree.ID"
);
$sqlQuery->where = array("TopTenCountry = 'ie'");
$sqlQuery->limit = "10";
// execute and return a Query-object
$result = $sqlQuery->execute();
$dataObject1 = new DataObjectSet();
foreach($result as $row) {
//move the SQL result data to the DataObjectSet
$dataObject1->push(new ArrayData($row));
}
return $dataObject1;
My template layer loops through the returned dataobjectset and outputs the Page with a link to it.
<% control GetTopTen(ie) %>
<li><a href="<% GetLink($ID) %>">$Title</a></li>
<% end_control %>
Thanks in advance!
Nick