Public Member Functions | |
__construct ($format="") | |
Creates a new PageRender2 object. | |
add ($component, $options=array()) | |
Add a TK component to the PR2 page. | |
dropCache ($uri=null) | |
Clear the page cache for uri $uri. | |
flash ($string="") | |
Add "flash" text to the page. | |
flashAndExit ($string="") | |
"Flash" text to the page, print the page, then exit | |
flashAndRedirect ($string, $url) | |
Store "flash" text in the session to be displayed on the next page, then redirect. | |
formatError ($format, $title, $error, $indent=0) | |
INSERT BRIEF DESCRIPTION HERE. | |
getClass ($key) | |
INSERT BRIEF DESCRIPTION HERE. | |
getClassInstance ($key) | |
Get a class instance that PR2 is storing, for a re-used class such as a translator. | |
getDefault ($key) | |
Retrieves PR2 default. | |
getInput ($key) | |
INSERT BRIEF DESCRIPTION HERE. | |
getLayout () | |
Get the active SLayout for this PR2 instance. | |
getOption ($key) | |
Get the value of an option. | |
getPage () | |
Get the SPage object. | |
getPageTemplate () | |
Get the active SPageTemplate for this PR2 instance. | |
includeCSS ($filename, $root= '') | |
Include a link to a CSS file in the page head. | |
includeJS ($filename, $root= '') | |
Include a link to a javascript file in the page head. | |
load ($input, $options=array(), $name="") | |
Load content into the page using a translator. | |
loadCSS ($css) | |
Load literal CSS to the ExtraCSS slot. | |
loadJS ($js, $slot= 'ExtraJS') | |
Load literal javascript to the ExtraJS slot (or another slot). | |
rebaseCserdUrls ($enable=true, $projectUrl=false) | |
INSERT BRIEF DESCRIPTION HERE. | |
render () | |
Render the page content, store it in the SPage buffer. | |
renderPrint ($format="html") | |
Render the page to the page buffer, then print it out. | |
setClass ($key, $value) | |
INSERT BRIEF DESCRIPTION HERE. | |
setOption ($key, $value) | |
Set a value for an option (to override a default value). | |
setToolkitTheme ($theme) | |
INSERT BRIEF DESCRIPTION HERE. | |
updateCachedVersion () | |
Add this page content to the cache manager. | |
useCachedVersion ($lifetime="") | |
Tell PR2 to use the cached version of a page instead of rendering each time. | |
Protected Member Functions | |
runTestSuite ($extras=null) | |
Build a report to tell a user agent whether the page has errors. |
PageRender2 is a framework for assembling a web page using any number of inputs. It is similar to a templating system, but is not the same thing. PR2 allows you to load any number of inputs in any number of different formats into a set of "slots" in your page.
The page can also be output in any format. You simply choose the translator for each piece of input, the target slot, the page layout (how the slots are assembled into an output format), and the page tempate (what parts of the page show). Then you can renderPrint your page.
5-37-07
Fall '06
PageRender2::__construct | ( | $ | format = "" |
) |
Creates a new PageRender2 object.
Detailed description
$format | [string]: which output format this object will produce (e.g., 'html', etc.) |
PageRender2::add | ( | $ | component, | |
$ | options = array() | |||
) |
Add a TK component to the PR2 page.
Load a TK component into the page using STransTK
$component | [TKComponent]: The TK component to be added to the page | |
$options | [array]: Additional translation options (as used with load()) |
PageRender2::dropCache | ( | $ | uri = null |
) |
Clear the page cache for uri $uri.
$uri | [string]: The URI for which we want to clear the page cache |
PageRender2::flash | ( | $ | string = "" |
) |
Add "flash" text to the page.
Append "flash" text (i.e., messages flashed to the user at the top of the page) to the flash slot. A page template may or may not display this slot.
$string | [string]: The flash text |
PageRender2::flashAndExit | ( | $ | string = "" |
) |
"Flash" text to the page, print the page, then exit
Use this function to present a fatal error message/access denied message to the user in the nicest way, then exit immediately.
$string | [string]: The flash text |
PageRender2::flashAndRedirect | ( | $ | string, | |
$ | url | |||
) |
Store "flash" text in the session to be displayed on the next page, then redirect.
Store "flash" text to be displayed to the user at the top of the next page using the SWAT global user object. Then redirect to that page. If that page is set up to display flash text, the text will appear there when the user arrives. This works well for showing confirmation messages after handling events/form submissions.
$string | [string]: The flash text | |
$url | [string]: The destination URL to redirect to |
PageRender2::formatError | ( | $ | format, | |
$ | title, | |||
$ | error, | |||
$ | indent = 0 | |||
) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$format | [TYPE]: DESCRIPTION | |
$title | [TYPE]: DESCRIPTION | |
$error | [TYPE]: DESCRIPTION | |
$indent | [TYPE]: DESCRIPTION |
PageRender2::getClass | ( | $ | key | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$key | [TYPE]: DESCRIPTION |
PageRender2::getClassInstance | ( | $ | key | ) |
Get a class instance that PR2 is storing, for a re-used class such as a translator.
Look for a stored instance of the class named $key. If it does not exist, create and store it Return it to the caller. This is used to buffer instances of translator objects so that they can be re-used.
$key | [string]: The name of the class for which we want a stored instance |
PageRender2::getDefault | ( | $ | key | ) |
Retrieves PR2 default.
Defaults store the default values of preferences for PR2, such as what the default input and output formats are, and what the default translator is for each input format.
$key | [string]: which default to retrieve |
PageRender2::getInput | ( | $ | key | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$key | [TYPE]: DESCRIPTION |
PageRender2::getLayout | ( | ) |
PageRender2::getOption | ( | $ | key | ) |
Get the value of an option.
If no value is set for the option $key, return the default value by calling getDefault(). If a value is set, return that value.
$key | [string]: The name of the option/default |
PageRender2::getPage | ( | ) |
PageRender2::getPageTemplate | ( | ) |
Get the active SPageTemplate for this PR2 instance.
Get the SPageTemplate object or subclass that represents the current page template for this PR2 instance.
PageRender2::includeCSS | ( | $ | filename, | |
$ | root = '' | |||
) |
Include a link to a CSS file in the page head.
Add a rel tag linking to a javascript file. By default, use the passed $filename as the complete path to the file. Or use one of the following values passed for $root as the base path:
$filename | [string]: The path to the CSS file | |
$root | [string]: The root of the path: blank, ProjectCSS, DefaultSkin, or CustomSkin |
PageRender2::includeJS | ( | $ | filename, | |
$ | root = '' | |||
) |
Include a link to a javascript file in the page head.
Add a script tag linking to a javascript file. By default, use the passed $filename as the complete path to the file. Or use one of the following values passed for $root as the base path:
$filename | [string]: The path to the javascript file | |
$root | [string]: The root of the path: blank, ProjectJS, DefaultSkin, or CustomSkin |
PageRender2::load | ( | $ | input, | |
$ | options = array() , |
|||
$ | name = "" | |||
) |
Load content into the page using a translator.
Use a translator to take input content (in any format for which there is a translator), translate it to the target output format, and store it in a slot in the page buffer.
By default, a load command appends its output to the Main slot.
Additional options can be specified in the $options array to change the destination slot or the input or output format. The load can also be given a name for later access.
$input | [mixed]: The input content to be translated (a string or object) | |
$options | [array]: Overrides to the defaults for this particular load | |
$name | [string]: The name of the load (deprecated) |
PageRender2::loadCSS | ( | $ | css | ) |
Load literal CSS to the ExtraCSS slot.
Load literal CSS into the ExtraCSS slot in the head of the page
$css | [string]: The literal CSS |
PageRender2::loadJS | ( | $ | js, | |
$ | slot = 'ExtraJS' | |||
) |
Load literal javascript to the ExtraJS slot (or another slot).
Load literal javascript into a slot in the (head of the) page
$js | [string]: The literal javascript code | |
$slot | [string]: The name of the slot, or blank to use the ExtraJS slot |
PageRender2::rebaseCserdUrls | ( | $ | enable = true , |
|
$ | projectUrl = false | |||
) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$enable | [TYPE]: DESCRIPTION | |
$projectUrl | [TYPE]: DESCRIPTION |
PageRender2::render | ( | ) |
Render the page content, store it in the SPage buffer.
Get the instance of our page layout class, and tell it to layout()
PageRender2::renderPrint | ( | $ | format = "html" |
) |
Render the page to the page buffer, then print it out.
INSERT FULL DESCRIPTION HERE
$format | [TYPE]: DESCRIPTION |
PageRender2::runTestSuite | ( | $ | extras = null |
) | [protected] |
Build a report to tell a user agent whether the page has errors.
PageRender2::setClass | ( | $ | key, | |
$ | value | |||
) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$key | [TYPE]: DESCRIPTION | |
$value | [TYPE]: DESCRIPTION |
PageRender2::setOption | ( | $ | key, | |
$ | value | |||
) |
Set a value for an option (to override a default value).
Override a default value in PR2, such as what translator is used for a given input type.
$key | [string]: The name of the option/default | |
$value | [mixed]: The new value for the option |
PageRender2::setToolkitTheme | ( | $ | theme | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
$theme | [TYPE]: DESCRIPTION |
PageRender2::useCachedVersion | ( | $ | lifetime = "" |
) |
Tell PR2 to use the cached version of a page instead of rendering each time.
Call this function before calling renderPrint(), typically at the top of your controller.
If this function finds that there is a cache existing within the cache lifetime, it will print that cache to the screen immediately, and exit bypassing the rest of the controller.
Pass in the $lifetime variable to specify for how many seconds the page cache should be valid before PR2 needs to call renderPrint() again to generate a new version of the page.
$lifetime | [int]: The number of seconds for which the cache should be valid |