This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The PageList class provides an object-oriented way to search pages. Since it extends the DatabaseItemList, it also provides pagination and sorting.

Instantiating the PageList object

	Loader::model('page_list'); 	$pl = new PageList();

Filtering Methods Available

$pl->ignorePermissions()

When called, this will instruct the PageList query that you don't want to check the permissions of the logged-in user. This may result in the page list including pages that user cannot view.

$pl->ignoreAliases()

Instructs the page list to ignore aliased pages.

$pl->includeSystemPages()

Instructs the page list to include system pages (e.g. the dashboard).

$pl->displayUnapprovedPages()

Instructs the page list to include pages that have not yet been approved.

$pl->filterByKeywords($keywords)

Filters files by keywords, which searches

  1. Name, Description, Indexed Content against MySQL fulltext functions
  2. Any collection attributes marked as being included in the search index

$pl->filterByName($name, $exact = false)

Filters the page list by page name.

$pl->filterByPath($path, $includeAllChildren = true)

Filters pages by path. Allows for just the immediate children or all to be searched.

$pl->filterByParentID($cParentID)

Filters pages by the parent ID of a given page.

$pl->filterByCollectionTypeID($ctID)

Only displays pages of a certain page type.

$pl->filterByUserID($userID)

Only displays pages owned by a particular user ID.

$pl->filterByIsApproved($isApproved)

Only displays pages that are either approved or not (depending on the passed value of $isApproved.)

$pl->filterByIsAlias($ia)

Filters by whether an item is an alias or not.

$pl->filterByCollectionTypeHandle($ctHandle)

Filters by page type handles. $ctHandle can also be an array of page type handles.

$pl->filterByDateAdded($date, $comparison = '=')

Filters by date the page was added. $comparison can be any MySQL comparison operator.

$pl->filterByPublicDate($date, $comparison = '=')

Filters by public date. $comparison can be any MySQL comparison operator.

$pl->filterByNumberOfChildren($number, $comparison = '=')

Filters by number of page children. $comparison can be any MySQL comparison operator.

$pl->filterByAttribute($attributeKeyHandle, $value, $comparison)

Filters by attribute.

$pl->filter($column, $value, $comparison)

Advanced users:
Passes a fliter directly to the "WHERE" clause. The value of $column must be a valid database column that's referenced in the PageList query.  Setting the value of $column to false will allow you to pass complex SQL into the $value field ex:
$pl->filter(false, '(ak_age = 10 OR ak_age IN (13,17,25) OR ak_age > 23)');
where 'age' would be the handle of a numeric page attribute

Sorting Methods

$pl->sortByRelevance()

Orders by index score descending. Only available when searching by keywords.

$pl->sortByDisplayOrder()

Orders by sitemap display order ascending.

$pl->sortByDisplayOrderDescending()

Orders by sitemap display order descending.

$pl->sortByPublicDate()

Orders by public date ascending.

$pl->sortByPublicDateDescending()

Orders by public date descending.

$pl->sortByName()

Orders by page name ascending.

$pl->sortByNameDescending()

Orders by name descending.

Getting Results

$pages = $pl->get($itemsToGet = 100, $offset = 0)

Gets all pages that fit the criteria.

$pl->getPage($page = false)

Gets a page of pages (taking into account $itemsPerPage, current page, etc...)

Loading Conversation