PagesRequest class

Methods for identifying and loading page from current request URL.

Methods in this class should be accessed from $pages->request(), i.e.

$page = $pages->request()->getPage();

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

Show class?             Show args?        

Common

NameReturnSummary 
checkScheme(Page $page)
(nothing)If the template requires a different scheme/protocol than what is here, then redirect to it. 
getClosestPage()
Page NullPageGet closest matching page when getPage() returns an error/NullPage
getFile()
stringGet the requested file 
getLanguageName()
stringGet request language name 
getLoginPageOrUrl()
string Page nullGet login Page object or URL to redirect to for login needed to access given $page
getPage()
Page NullPageGet the requested page
getPageForUser(Page $page, User $user)
Page NullPageUpdate/get page for given user
getPageNum()
null intGet the requested pagination number 
getPageNumPrefix()
null stringGet the requested pagination number prefix 
getRedirectType()
intGet the redirect type (0, 301, 302, 307, 308) 
getRedirectUrl()
stringGet the redirect URL 
getRequestFile()
stringGet the requested file (alias of getFile method) 
getRequestPage()
NullPage PageGet page that was requested 
getRequestPath()
stringGet request path 
getResponseCode()
intGet response http code for this request 
getResponseCodeName()
stringGet response type name for this request 
getResponseCodeNames()
arrayGet all possible response code names indexed by http response code 
getResponseError()
stringGet message about response only if response was an error, blank otherwise 
getResponseMessage()
stringGet message string about response 
setPage($page)
Page NullPage nullSet current request page 
setRedirectPath(string $redirectPath)
(nothing)Set the redirect path 
setRedirectUrl(string $redirectUrl)
(nothing)Set the redirect URL 
setRequestPath(string $requestPath)
(nothing)Set request path 
setResponseMessage(string $message)
(nothing)Set response message 

Advanced

NameReturnSummary 
getPageInfo()
arrayGet array of page info (as provided by PagePathFinder) 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.244

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani