API:sendForward
From MODx Wiki
API Function Definition:
sendForward
- Versions
- > 0.9.5
- Return Values
- Success: null
- Fail: null
- Data Type
- void
- Object Hierarchy
- DocumentParser
void sendForward(int $id[, string $responseCode]);
Signals the parser to forward to a new document. This function does not reload the entire page, it simply changes documentIdentifier and runs prepareResponse again.
[edit]
Examples
if ($modx->documentIdentifier != 1) { // Go to home page $modx->sendForward(1); }
[edit]
Related Functions
[edit]
Function Source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 110 |
function sendForward($id, $responseCode= '') { if ($this->forwards > 0) { $this->forwards= $this->forwards - 1; $this->documentIdentifier= $id; $this->documentMethod= 'id'; $this->documentObject= $this->getDocumentObject('id', $id); if ($responseCode) { header($responseCode); } $this->prepareResponse(); exit; } else { $this->messageQuit('Too many forward attempts.', 'The request could not be completed due to too many unsuccessful forward attempts.'); exit; } }
[edit]
