Abstract Class JDocument

Description

Document class, provides an easy interface to parse and display a document

Located in /document/document.php (line 28)

patTemplate
   |
   --JTemplate
      |
      --JDocument
Direct descendents
Class Description
 class JDocumentHTML DocumentHTML class, provides an easy interface to parse and display an html document
Variable Summary
 string $_charset
 string $_language
 string $_lineEnd
 string $_mime
 string $_namespace
 string $_profile
 array $_renderers
 array $_script
 array $_scripts
 array $_style
 string $_tab
 string $_title
Method Summary
 JDocument __construct (string $type, [array $attributes = array()])
 void addScript (string $url, [string $type = "text/javascript"])
 void addScriptDeclaration (string $content, [string $type = 'text/javascript'])
 void addStyleDeclaration (string $content, [string $type = 'text/css'])
 void addStyleSheet (string $url, [string $type = 'text/css'], [string $media = null], [mixed $attribs = array()])
 void display (string $template, [boolean $compress = false], [mixed $outline = false])
 The execRenderer (string $type, string $name, [array $params = array()])
 string fetchBody ()
 string fetchHead ()
 string getCharset ()
 jdocument &getInstance ([type $type = 'html'], [mixed $attributes = array()])
 string getLang ()
 string getTitle ()
 void parse (string $template, [string $filename = 'index.php'], [string $directory = 'templates'])
 void setCharset ([string $type = 'utf-8'])
 void setLang ([string $lang = "eng_GB"])
 void setLineEnd (string $style)
 void setMimeEncoding ([string $type = 'text/html'])
 void setTab (string $string)
 void setTitle (string $title)
 string _addRenderer (string $type, string $name)
 string _getLineEnd ()
 string _getTab ()
 string _load (mixed $directory, string $filename, string $template)
Variables
string $_charset = 'utf-8' (line 52)

Contains the character encoding string

  • access: private
string $_language = 'en' (line 60)

Contains the page language setting

  • access: private
string $_lineEnd = "\12" (line 44)

Contains the line end string

  • access: private
string $_mime = '' (line 68)

Document mime type

  • access: private
string $_namespace = '' (line 76)

Document namespace

  • access: private
string $_profile = '' (line 84)

Document profile

  • access: private
array $_renderers = array() (line 132)

Array of renderers

  • access: private
array $_script = array() (line 100)

Array of scripts placed in the header

  • access: private
array $_scripts = array() (line 92)

Array of linked scripts

  • access: private
array $_style = array() (line 116)

Array of included style declarations

  • access: private
array $_styleSheets = array() (line 108)

Array of linked style sheets

  • access: private
string $_tab = "\11" (line 36)

Tab string

  • access: private
string $_title = '' (line 124)

Page title

  • access: private
Methods
Constructor __construct (line 143)

Class constructor

JDocument __construct (string $type, [array $attributes = array()])
  • string $type: (either html or tex)
  • array $attributes: Associative array of attributes

Redefinition of:
JTemplate::__construct()
Class constructor

Redefined in descendants as:
addScript (line 210)

Adds a linked script to the page

  • access: public
void addScript (string $url, [string $type = "text/javascript"])
  • string $url: URL to the linked script
  • string $type: Type of script. Defaults to 'text/javascript'
addScriptDeclaration (line 223)

Adds a script to the page

  • access: public
void addScriptDeclaration (string $content, [string $type = 'text/javascript'])
  • string $content: Script
  • string $type: Scripting mime (defaults to 'text/javascript')
addStyleDeclaration (line 251)

Adds a stylesheet declaration to the page

  • access: public
void addStyleDeclaration (string $content, [string $type = 'text/css'])
  • string $content: Style declarations
  • string $type: Type of stylesheet (defaults to 'text/css')
addStyleSheet (line 236)

Adds a linked stylesheet to the page

  • access: public
void addStyleSheet (string $url, [string $type = 'text/css'], [string $media = null], [mixed $attribs = array()])
  • string $url: URL to the linked style sheet
  • string $type: Mime encoding type
  • string $media: Media type that this stylesheet applies to
display (line 469)

Outputs the template to the browser.

  • access: public
void display (string $template, [boolean $compress = false], [mixed $outline = false])
  • string $template: The name of the template
  • boolean $compress: If true, will display information about the placeholders

Redefinition of:
JTemplate::display()
Execute and display a the template
execRenderer (line 420)

Execute a renderer

  • return: output of the renderer
  • access: public
The execRenderer (string $type, string $name, [array $params = array()])
  • string $type: The type of renderer
  • string $name: The name of the element to render
  • array $params: Associative array of values
fetchBody (line 509)

Return the document body

  • access: public
  • abstract:
string fetchBody ()
fetchHead (line 498)

Return the document head

  • access: public
  • abstract:
string fetchHead ()

Redefined in descendants as:
getCharset (line 274)

Returns the document charset encoding.

  • access: public
string getCharset ()
getInstance (line 184)

Returns a reference to the global JDocument object, only creating it if it doesn't already exist.

This method must be invoked as:

  $document = &JDocument::getInstance();

  • return: The document object.
  • access: public
jdocument &getInstance ([type $type = 'html'], [mixed $attributes = array()])
  • type $type: The document type to instantiate

Redefinition of:
JTemplate::getInstance()
Returns a reference to a global Template object, only creating it if it doesn't already exist.
getLang (line 296)

Returns the document language.

  • access: public
string getLang ()
getTitle (line 332)

Return the title of the page.

  • access: public
string getTitle ()
parse (line 445)

Parse a file and create an internal patTemplate object

  • access: public
void parse (string $template, [string $filename = 'index.php'], [string $directory = 'templates'])
  • string $template: The template to look for the file
  • string $filename: The actual filename
  • string $directory: The directory to look for the template

Redefinition of:
JTemplate::parse()
Parse a file

Redefined in descendants as:
setCharset (line 263)

Sets the document charset

  • access: public
void setCharset ([string $type = 'utf-8'])
  • string $type: Charset encoding string
setLang (line 285)

Sets the global document language declaration. Default is English.

  • access: public
void setLang ([string $lang = "eng_GB"])
  • string $lang
setLineEnd (line 360)

Sets the line end style to Windows, Mac, Unix or a custom string.

  • access: public
void setLineEnd (string $style)
  • string $style: "win", "mac", "unix" or custom string.
setMimeEncoding (line 349)

Sets the document MIME encoding that is sent to the browser.

This usually will be text/html because most browsers cannot yet accept the proper mime settings for XHTML: application/xhtml+xml and to a lesser extent application/xml and text/xml. See the W3C note (http://www.w3.org/TR/xhtml-media-types/) for more details.

  • access: public
void setMimeEncoding ([string $type = 'text/html'])
  • string $type
setTab (line 395)

Sets the string used to indent HTML

  • access: public
void setTab (string $string)
  • string $string: String used to indent ("\11", "\t", ' ', etc.).
setTitle (line 307)

Sets the title of the page

  • access: public
void setTitle (string $title)
  • string $title
_addRenderer (line 546)

Adds a renderer to be called

  • return: The contents of the template
string _addRenderer (string $type, string $name)
  • string $type: The renderer type
  • string $name: The renderer name
_getLineEnd (line 383)

Returns the lineEnd

  • access: private
string _getLineEnd ()
_getTab (line 406)

Returns a string containing the unit for indenting HTML

  • access: private
string _getTab ()
_load (line 520)

Load a template file

  • return: The contents of the template
string _load (mixed $directory, string $filename, string $template)
  • string $template: The name of the template
  • string $filename: The actual filename

Inherited Methods

Inherited From JTemplate

 JTemplate::JTemplate()
 JTemplate::__construct()
 JTemplate::display()
 JTemplate::fetch()
 JTemplate::getInstance()
 JTemplate::parse()
 JTemplate::setTemplateCachePrefix()
 JTemplate::__destruct()

Documentation generated on Sat, 4 Feb 2006 14:23:16 +0100 by phpDocumentor 1.3.0RC4