The Page Request Cycle
When a client makes a request to view a web page, the framework will load your Page-Controller logic and allow you to load and process your html views using simple css selectors (for example #id, .classname, etc). Once processing is completed, a reply is sent back to the client that made the request. The replied text contains your html code and may include embedded javascript/css stylesheet.
If a request was made via an ajax call, then a JSON object is returned to the client. The returned JSON object may include the action scripts (a mixed of jQuery and JavaScripts) needed to carry out a specific task within the client's web browser.
Synchronous Page Request Execution
- Init - Called after the page object is created. Used for initializing connections and loading page source
- Authorize - Used to secure or grant access to the page
- Switchboard - Called whenever a switchboard action is requested.
- Load - Used for loading additional views/content into web page.
- Custom Event Request Handler - Triggers the event raised by client
- PreRender - Used for making final modifications to page just before html is extracted from the DOM
- PostRender - Called after the HTML is extracted from the DOM and all external and internal processing have been completed
- Reply - Called just after the content is sent back to the client.
- Finalize - Called before the page object is destroyed; Can be used to close open connections etc
Asynchronous (AJAX) Page Request Execution
- Init - Called after the page object is created. Used for initializing connections and loading page source
- Authorize - Used to secure or grant access to the page
- Switchboard - Called whenever a switchboard action is requested.
- Load - Used for loading additional views/content into web page.
- Custom Event Request Handler - Triggers the event raised by client
- Reply - Called just after the JSON content is sent back to the client.
- Finalize - Called before the page object is destroyed; Can be used to close open connections etc
Data Reset handler
- Reset - This handler is called before the page data storage is reset. The RaxanWebPage->resetOnFirstLoad property must be set to true in order for the data to be reset on first load
Page event handler are prefixed with an "_" as shown in the example below:
<?php
require_once('raxan/pdi/autostart.php');
class NewPage extends RaxanWebPage {
protected function _init() {
$this->append('* This is the init handler <br />');
}
protected function _load() {
$this->append('* This is the load handler <br />');
}
protected function _prerender() {
$this->append('* This is the prerender handler <br />');
}
}
?>
Connecting The Dots >>