Class webpage

Description

The webpage page class.

This is the main focus of the Axyl framework for generating webpage content of any kind and for any device. We envisage the standard page structure with a head, body and foot section. Depending on the device this might not be exactly right, but it doesn't really matter, since you have complete control over the content.

Located in /webpage-defs.php (line 466)

user
   |
   --session
      |
      --webstream
         |
         --webpage
Direct descendents
Class Description
 class response THE RESPONSE CLASS
Variable Summary
 mixed $body
 mixed $foot
 mixed $generated
 mixed $head
 mixed $pluginset
 mixed $template
 mixed $theme
Method Summary
 webpage webpage ([string $title = ""], [string $template = ""], [mixed $sitetheme = ""], [string $stylesheet = ""], string $theme)
 void add (string $morestuff)
 void add_named_script (string $script, string $name, [string $language = "javascript"])
 void add_script (string $script, [string $language = "javascript"])
 void add_scriptsrc (string $src, [string $language = "javascript"])
 void assign_DTD ([string $DTD = ""])
 void generate ()
 array get_stylesheets ([string $ss = ""], [string $theme = "?"])
 string inline_end ()
 void inline_start ()
 void insert_metatag (string $id, object $metatag)
 void plugin (string $pluginid, mixed $content)
 void plugin_inline ([mixed $pluginid = ""])
 void plugin_replace (string $pluginid, mixed $content)
 string render ()
 void send ()
 void set_metatag (string $name, string $content, string $language, string $scheme)
 void set_onload (string $onload)
 void set_style (string $style)
 void set_stylesheet ([string $ss = ""])
 void set_template (string $templatename)
 void set_theme (string $theme)
 void set_title (string $title)
Variables
mixed $body (line 471)

Webpage body object

mixed $foot (line 473)

Webpage foot object

mixed $generated = false (line 490)

True if page has been generated

mixed $head (line 469)

Webpage head object

mixed $pluginset (line 493)

Set of plugins with content

mixed $template = "" (line 475)

The name of the template which was applied, if any

mixed $templatefile = "" (line 477)

The file the template content is to be found in

mixed $theme = "" (line 485)

Theme to apply to the page. This should be a single-word ID, and

there should be a sub-directory of the same name in the 'templates' directory, with templates and stylesheet(s) in it which comprise the theme. This is how we provide different template sets and stylesheets for branding purposes.

Inherited Variables

Inherited from webstream

webstream::$buffered
webstream::$cached
webstream::$cache_expiry
webstream::$cache_path
webstream::$cache_regen
webstream::$content
webstream::$replacement

Inherited from session

session::$cookiename
session::$db_backed
session::$error_message
session::$guest_browser_lifetime
session::$last_logintime
session::$lifetime
session::$logins_exceeded_msg
session::$logins_exceeded_option
session::$logins_exceeded_redirect
session::$login_type
session::$session_id
session::$session_record

Inherited from user

user::$auth_code
user::$email
user::$enabled
user::$encrypted_passwords
user::$group_info
user::$group_names
user::$hasgroups
user::$hasIPlist
user::$IP
user::$limit_logins
user::$name
user::$password
user::$total_logins
user::$userid
user::$user_groups_cnt
user::$user_record
user::$user_type
user::$valid
Methods
Constructor webpage (line 509)

Constructor Create a new webpage object. When this object is created it implicitly starts buffering with the ob_start() call by creating a webstream.

NOTES: If you name your stylesheets after the APP_PREFIX (see your application.php setup file), eg: 'haka.css' and 'haka_ie.css', then the system will find them for you. The same applies if you call them 'sitestyle.css' and 'sitestyle_ie.css'.

webpage webpage ([string $title = ""], [string $template = ""], [mixed $sitetheme = ""], [string $stylesheet = ""], string $theme)
  • string $title: Webpage title string
  • string $template: Template for this webpage
  • string $theme: Theme to apply. This is for branding purposes
  • string $stylesheet: Name of stylesheet. Defaults to {APP_PREFIX}.css
add (line 561)

Add to the body content

void add (string $morestuff)
  • string $morestuff: Content to append to the body of the webpage
add_named_script (line 576)

Add named script This adds a specific lump of script to the body 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_script (line 585)

Add named script to the body

void add_script (string $script, [string $language = "javascript"])
  • string $script: Script to insert into the body of the webpage
  • string $language: Language of this script (default javascript)
add_scriptsrc (line 594)

Add script URL to the body

void add_scriptsrc (string $src, [string $language = "javascript"])
  • string $src: URL reference to script to insert into the body
  • string $language: Language of this script (default javascript)
assign_DTD (line 904)

Assign the DTD for the resident head page section. We have two ways to do this: directly via passed parameter $DTD, or indirectly by using the content (browser) type, and looking up the DTD from the array of DTD specifiers created in the response object.

void assign_DTD ([string $DTD = ""])
  • string $DTD: Optional override DTD specifier string
generate (line 953)

Generate the webpage content This routine is usually called after all the set-up calls for the head, body etc. have been made. This echoes each page section to the buffer, in preparation for delivery to the browser.

void generate ()
get_stylesheets (line 742)

Get the filenames for the main stylesheet and (optionally) the

stylesheet for Internet Explorer compatible browsers. Note: this should only be a filename, not a path. If a theme has been defined then the stylesheet will be expected to be in the subdirectory of the same name as the theme, under the 'templates' directory. If not then the stylesheet is expected to be in the website root dir. Defaults are in effect as follows: If the stylesheet is nullstring, then we look for a stylesheet in the appropriate directory with a name of APP_PREFIX.css. If that isn't found we try looking for 'sitestyle.css'. Same applies for the IE stylesheet, but with "_ie" appended to the filename part. We return the results in an associative array, with elements: returned_array["css"] = standard stylsheet returned_array["css_ie"] = IE stylsheet returned_array["css_ns"] = Netscape 4.xx stylsheet

  • return: Associative array of stylesheets as located.
array get_stylesheets ([string $ss = ""], [string $theme = "?"])
  • string $ss: Name of normal stylesheet (others are derived).
  • string $theme: The theme to retreive the stylesheets for.
inline_end (line 677)

End inline buffering Usually used as in: <?php $s = $page->inline_end(); Then $s will contain all the HTML between inline_start/inline_end.

string inline_end ()
inline_start (line 666)

Begin inline buffering

If you want to include some 'naked' HTML in-line with your webpage content, then call this method, then close the Php script with the usual "?>" tag. Follow this with your HTML, then restart Php script and grab the resulting HTML with... <?php $s = $page->inline_end(); Then $s will contain all the HTML between inline_start/inline_end.

void inline_start ()
insert_metatag (line 932)

Insert a ready-made meta tag object into the webpage head section.

void insert_metatag (string $id, object $metatag)
  • string $id: Meta tag unique ID
  • object $metatag: Meta tag object to insert
plugin (line 619)

Add content to a plugin Plugins are regions of a webpage which you want to plug content into.

This is the method to call to add content to a named region or plugin. The plugin ID (name) is related to a COMMENT TAG which appears in the template of the page. If the plugin doesn't exist then one is created otherwise the content is simply appended to that already defined. The 'content' can be any one of the following types: String - A literal string of content to put in the plugin Path - Path to a file containing content (can be relative) Function - A function definition, eg: "foo('xyx')" to return content Object - An object. Must be a descendant of RenderableObject. NB: This method can be called multiple times for the given plugin ID, and content will be accumulated each time. NB: When you nominate an object or a function to provide content, the system assumes you want these generated "late" - ie. at the time the webpage is being sent back to the user agent. If you want content to be inserted early, then use literal strings.

void plugin (string $pluginid, mixed $content)
  • string $pluginid: ID of this plugin. Used to find plugin location
  • mixed $content: The plugin content (literal, function, object...)
plugin_inline (line 642)

Start/stop inline plugin content definition

This method allows plugin content to be taken from inline content in the script page itself. At the start of the content call this method with the name of the plugin (pluginid) you want to put the content into. At the end of the content, call this method with no parameter.

void plugin_inline ([mixed $pluginid = ""])
plugin_replace (line 630)

Define or redefine a plugin. This acts similarly to the above plugin() method, except that here we replace the existing content, if any is present, with this content.

void plugin_replace (string $pluginid, mixed $content)
  • string $pluginid: ID of this plugin. Used to find plugin location
  • mixed $content: The plugin content (literal, function, object...)
render (line 1000)

Generate the content into the buffer, then return the content.

  • return: The webpage content complete, as a string
string render ()
send (line 991)

Generate the content and then send it to the user browser.

void send ()
set_metatag (line 943)

Add a meta tag to the webpage head section.

void set_metatag (string $name, string $content, string $language, string $scheme)
  • string $name: Meta tag name
  • string $content: Meta tag content
  • string $language: Optional language specifier for content
  • string $scheme: Optional scheme specifier for content
set_onload (line 811)

Define the script to execute after page has loaded

void set_onload (string $onload)
  • string $onload: Script to execute when page loads
set_style (line 832)

Define the style settings for the webpage. Usually the stylesheet will be all you require, however occasionally it is necessary to have specific styles for a page. Set these here, but make sure to provide the FULL style complete with <style></style> tags.

void set_style (string $style)
  • string $style: Style to insert into the webpage
set_stylesheet (line 713)

Set the filenames for the main stylesheet and (optionally) the stylesheet for Internet Explorer compatible browsers.

void set_stylesheet ([string $ss = ""])
  • string $ss: Name of normal stylesheet (others are derived)
set_template (line 845)

Define the template for the webpage.

The $templatename can be the special "plain" which is a pseudo template of vanilla content, a fll path to a file, or a name. If it is a simple name, then the system knows where to find it and constructs a full path to the file from it.

void set_template (string $templatename)
  • string $templatename: The name of, or full path to the template file
set_theme (line 692)

Define the theme

Set the theme to apply to the page. This should be a single-word ID, and there should be a sub-directory of the same name in the 'templates' directory, with templates and stylesheet(s) in it which comprise the theme. This is how we provide different template sets and stylesheets for branding purposes.

void set_theme (string $theme)
  • string $theme: Theme name for this webpage
set_title (line 820)

Define the webpage title

void set_title (string $title)
  • string $title: Title to give the webpage

Inherited Methods

Inherited From webstream

 webstream::webstream()
 webstream::add_content()
 webstream::cache()
 webstream::close_webstream()
 webstream::discard()
 webstream::length()
 webstream::open_webstream()
 webstream::replace()
 webstream::replace_content()
 webstream::reset_webstream()
 webstream::send_errorcode_and_die()
 webstream::send_error_and_die()
 webstream::send_to_browser()
 webstream::send_to_file()
 webstream::webpage_content()

Inherited From session

 session::session()
 session::delete_cookie()
 session::identify_user()
 session::on_logins_exceeded()
 session::recover()
 session::session_clear()
 session::session_create()
 session::session_delete()
 session::session_valid()
 session::set_cookie()
 session::set_cookiename()
 session::set_guest_browser_lifetime()
 session::set_lifetime()
 session::set_sessiontype()

Inherited From user

 user::user()
 user::authenticate()
 user::authenticate_authid()
 user::authenticate_ipaddress()
 user::authenticate_userid()
 user::friendlyName()
 user::get_auth_code()
 user::get_groups()
 user::get_user_by_auth_code()
 user::get_user_by_id()
 user::get_user_by_ip()
 user::group_ids_list()
 user::group_names_list()
 user::ismemberof_group()
 user::ismemberof_group_in()
 user::ismemberof_group_with_id()
 user::isvalid()
 user::set_encrypted_passwords()
 user::set_password()

Documentation generated by phpDocumentor 1.3.0RC3