Pages Loader

Implements page finding/loading methods for the $pages API variable.

Please always use $pages->method() rather than $pages->loader->method() in cases where there is overlap.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the PagesLoader class also inherits all the methods and properties of: Wire.

Show $var?     Show args?       Only hookable?    

Retrieve

NameReturnSummary 
$pages->loader->count()
int

Count and return how many pages will match the given selector string

 
$pages->loader->find($selector)
PageArray array

Given a Selector string, return the Page objects that match in a PageArray.

 
$pages->loader->findByName(string $name)
array NullPage Page PageArray

Find page(s) by name

 
$pages->loader->findCache($selector)
PageArray array

Find pages and cache the result for specified period of time

 
$pages->loader->findMin($selector)
PageArray

Minimal find for reduced or delayed overload in some circumstances

 
$pages->loader->findOne($selector)
Page NullPage

Like find() but returns only the first match as a Page object (not PageArray)

 
$pages->loader->get($selector)
Page NullPage

Returns the first page matching the given selector with no exclusions

 
$pages->loader->getById($_ids)
PageArray Page NullPage

Given an array or CSV string of Page IDs, return a PageArray

 
$pages->loader->getByPath(string $path)
Page int

Get a page by its path, similar to $pages->get('/path/to/page/') but with more options

 
$pages->loader->getFresh($selectorOrPage)
Page NullPage

Get a fresh, non-cached copy of a Page from the database

 
$pages->loader->getNativeColumnValue($id, string $column)
int string bool

Get value of of a native column in pages table for given page ID

 
$pages->loader->getNumChildren($page)
int

Load total number of children from DB for given page

 
$pages->loader->getPath($id)
string

Given an ID return a path to a page, without loading the actual page

 
$pages->loader->has($selector)
array int

Is there any page that matches the given $selector in the system? (with no exclusions)

 

Debug

NameReturnSummary 
$pages->loader->debug()
bool

Get or set debug state

 
$pages->loader->getLastPageFinder()
PageFinder null

Get last used instance of PageFinder (for debugging purposes)

 

Additional methods and properties

In addition to the methods and properties above, PagesLoader also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252