3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 950 Views |
-
[SOLVED] How to get an array of pages ID?

15 January 2010 at 5:26am Last edited: 15 January 2010 1:54pm
Hi there
I'm trying to get automatically an array of pages id (in ex. 29,38):
function GetCategoryNews() {
$holderid = DataObject::get("NewsHolder","ParentID = $this->ID");
...
$doSet = DataObject::get(
$callerClass = "NewsPage",
$filter = "`SiteTree`.ParentID IN (29,38)",
$sort = "Date DESC",
$join = "",
$limit = ""
);
return $doSet ? $doSet : false;
}Maybe someone has an example how to get an array of pages ID or can help with this?
Best regards
Mindaugas -
Re: [SOLVED] How to get an array of pages ID?

15 January 2010 at 12:18pm
Sorry not sure I completely understand you here. The code you provided would get all the newspages which have the parents IDs of 29 or 38 that should work fine.
However your title suggests you want an array of all the Page ID's. For that you can use the map() method on any dataobjectset to return an array from a dataobjectset.
-
Re: [SOLVED] How to get an array of pages ID?

15 January 2010 at 1:53pm
No worries, I found solution - just made "holderid" as array:
$filter = "`SiteTree`.ParentID IN ($holderid)"
Anyway, thanks for the response!
| 950 Views | ||
|
Page:
1
|
Go to Top |


