3215 Posts in 848 Topics by 811 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1088 Views |
-
Using multileveled DataObjectSets in a control?

8 July 2009 at 2:32am Last edited: 8 July 2009 2:34am
Hi!
I have a method in my controller which collects data like this:
public function GetData() {
$sqlQuery = new SQLQuery();
$sqlQuery->select("website");
$sqlQuery->from("listsitem");
$sqlQuery->groupby("website");
$result = $sqlQuery->execute();
$data = new DataObjectSet();
foreach($result as $row) {
$data->push(DataObject::get("ListsItem", "website ='".$row['website']."'", "", "", 2));}
}Before i did like this.
public function GetData() {
return DataObject::get("ListsItem", "website ='".$row['website']."'", "", "", 2));
}
And that worked fine with just:
<% control GetData %>
...
<% end_control%>But how do i use the values from the dataset if its a multilevel array? I can't seem to find anything about this in the manual.
I would be very grateful for help with this!
-
Re: Using multileveled DataObjectSets in a control?

8 July 2009 at 10:48pm
Anyway, i solved it by iterating in the controller, instead of the template
$data = new DataObjectSet();
foreach($result as $row) {
$tmpRes = DataObject::get("ListsItem", "website ='".$row['website']."', "", "", 2);
foreach($tmpRes as $t) {
$data->push($t);
}
}
| 1088 Views | ||
|
Page:
1
|
Go to Top |

