Class page_section

Description

The page section class

The class takes care of page sections. A page section is any part of a webpage. Page sections we define for HTML pages are: head, body and foot. Each section has a common set of properties and methods and these are defined here.

Located in /plugin-defs.php (line 37)

RenderableObject
   |
   --page_section
Direct descendents
Class Description
 class plugin Plugin class A plugin is something which can be used by the system to render content to be plugged into a webpage in any specified place.
 class head The head class.
 class body The body class The class is a special kind of page section. It contains all of the main page content.
 class foot The foot class
 class error_page The error page class Allows us to render errors as either HTML or WML.
Variable Summary
 mixed $content
 mixed $script
 mixed $scriptsrc
Method Summary
 page_section page_section ([string $content = ""])
 void add (string $newstuff)
 void add_named_script (string $script, string $name, [string $language = "javascript"])
 void add_popup_script (string $popupname, [integer $width = false], [integer $height = false], [integer $left = false], [integer $top = false], [string $features = "toolbar=no,status=no,scrollbars=no,resizable=yes"])
 void add_script (string $script, [string $language = "javascript"])
 void add_scriptsrc (string $src, [string $language = "javascript"])
 void clear ()
 string get_template ([string $templatefile = ""])
 string get_trimcontent ()
 string html ()
 void replace (string $tag, string $newstuff)
 string script ()
 string wml ()
Variables
mixed $content = "" (line 40)

Page section content

mixed $script (line 45)

Script content for this page section

mixed $scriptsrc (line 48)

Scripts which are sourced via a URL

Methods
Constructor page_section (line 55)

Constructor Create a new page section object.

page_section page_section ([string $content = ""])
  • string $content: Initial page content
add (line 63)

Add new content to the page section.

void add (string $newstuff)
  • string $newstuff: Initial page content
add_named_script (line 150)

This adds a specific lump of script to the webpage under a unique name.

It allows you to collect multiple additions of script content under a single grouping, and so cause the final rendering to group it all together.

void add_named_script (string $script, string $name, [string $language = "javascript"])
  • string $script: Script content (omit <script> tags)
  • string $name: Script content grouping identity
  • string $language: The language the script is in
add_popup_script (line 102)

Add popup window scripting.

This method adds Javascript which specifically supports the opening of a popup window from a function call elsewhere in the webpage. There are various options to force the size and position, or leave to be passed as parameters in the javascript function call. NB: This does NOT open the window. It inserts the Javascript for you to be able to call a function to open the window from elsewhere in the page.

void add_popup_script (string $popupname, [integer $width = false], [integer $height = false], [integer $left = false], [integer $top = false], [string $features = "toolbar=no,status=no,scrollbars=no,resizable=yes"])
  • string $popupname: The name you want the function to be called
  • integer $width: Width (px) of window if fixed, else will be a parameter
  • integer $height: Height (px) of window if fixed, else will be a parameter
  • integer $left: Left offset (px) of window if fixed, else will be a parameter
  • integer $top: Left offset (px) of window if fixed, else will be a parameter
  • string $features: The window features, if you want to override the defaults
add_script (line 137)

Add more scripting to this page section.

void add_script (string $script, [string $language = "javascript"])
  • string $script: Script content (omit <script> tags)
  • string $language: The language the script is in
add_scriptsrc (line 164)

Add script reference link Add more scripting to this section in the form of a link to a script source file.

void add_scriptsrc (string $src, [string $language = "javascript"])
  • string $src: URL pointing to the script
  • string $language: The language the script is in
clear (line 71)

Clear all content from the page section.

void clear ()
get_template (line 219)

Read in the template for this page section.

  • return: The full content of the template
string get_template ([string $templatefile = ""])
  • string $templatefile: The full path of the template to get
get_trimcontent (line 81)

Return content, if not null or newline.

  • return: The page section content
string get_trimcontent ()
html (line 247)

This renders the page section as HTML.

  • return: The page section as HTML.
string html ()

Redefinition of:
RenderableObject::html()
Return output suitable for normal HTML-capable device. This method must be over-ridden by a method of the same name in the descendant class which renders output to web browsers.

Redefined in descendants as:
  • head::html() : This renders the head as HTML. After the title and the meta tags
  • body::html() : This renders the body as HTML.
  • deck::html() : This renders the body as HTML.
  • foot::html() : This renders the foot as HTML.
  • error_page::html() : This renders the error page section as HTML. We do this simply as a heading at level 3 (h3), and the message content.
replace (line 208)

Replaces multiple occurrences of the given tag (pattern) in the body content with the specified new stuff.

void replace (string $tag, string $newstuff)
  • string $tag: Pattern to replace in content
  • string $newstuff: Stuff to replace the tag with
script (line 176)

Returns all of the defined script. Literal script is rendered for each language if more than one language is being used. Each language is bracketed with the usual <script language=foo></script> tags. Any script sources (URL references to scripts) are also rendered.

  • return: All the defined script content including source references
string script ()
wml (line 255)

This renders the page section as WML.

  • return: The page section as WML.
string wml ()

Redefinition of:
RenderableObject::wml()
Return output suitable for normal wap-capable device. This method must be over-ridden by a method of the same name in the descendant class which renders output to wap devices.

Redefined in descendants as:
  • head::wml() : Use render() to render this element in your page.
  • body::wml() : This renders the body as WML.
  • deck::wml() : This renders the deck content.
  • foot::wml() : This renders the foot as WML.
  • error_page::wml() : This renders the error page section as WML. We do this simply as a single card with the appropriate title, and the content on the card in paragraph tags.

Inherited Methods

Inherited From RenderableObject

 RenderableObject::RenderableObject()
 RenderableObject::html()
 RenderableObject::render()
 RenderableObject::wml()
 RenderableObject::wmlup()
 RenderableObject::xml()

Documentation generated by phpDocumentor 1.3.0RC3