Pages Request

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 $var?     Show args?       Only hookable?    

Common

NameReturnSummary 
$pages->request->checkScheme(Page $page)
None

If the template requires a different scheme/protocol than what is here, then redirect to it.

 
$pages->request->getClosestPage()
Page NullPage

Get closest matching page when getPage() returns an error/NullPage

$pages->request->getFile()
string

Get the requested file

 
$pages->request->getLanguageName()
string

Get request language name

 
$pages->request->getLoginPageOrUrl()
string Page null

Get login Page object or URL to redirect to for login needed to access given $page

$pages->request->getPage()
Page NullPage

Get the requested page

$pages->request->getPageForUser(Page $page, User $user)
Page NullPage

Update/get page for given user

$pages->request->getPageInfo()
array

Get array of page info (as provided by PagePathFinder)

 
$pages->request->getPageNum()
null int

Get the requested pagination number

 
$pages->request->getPageNumPrefix()
null string

Get the requested pagination number prefix

 
$pages->request->getRedirectType()
int

Get the redirect type (0, 301, 302, 307, 308)

 
$pages->request->getRedirectUrl()
string

Get the redirect URL

 
$pages->request->getRequestFile()
string

Get the requested file (alias of getFile method)

 
$pages->request->getRequestPage()
NullPage Page

Get page that was requested

 
$pages->request->getRequestPath()
string

Get request path

 
$pages->request->getResponseCode()
int

Get response http code for this request

 
$pages->request->getResponseCodeName()
string

Get response type name for this request

 
$pages->request->getResponseCodeNames()
array

Get all possible response code names indexed by http response code

 
$pages->request->getResponseError()
string

Get message about response only if response was an error, blank otherwise

 
$pages->request->getResponseMessage()
string

Get message string about response

 
$pages->request->setPage($page)
Page NullPage null

Set current request page

 
$pages->request->setRedirectPath(string $redirectPath)
None

Set the redirect path

 
$pages->request->setRedirectUrl(string $redirectUrl)
None

Set the redirect URL

 
$pages->request->setRequestPath(string $requestPath)
None

Set request path

 
$pages->request->setResponseMessage(string $message)
None

Set response message

 

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.252