Sitellite Application Framework
Class Tree         Index         All Elements

Class: Document

Source Location: Program_Root/Misc/Document.php

Class Overview


This package contains the data of the current page request, and renders it for the Sitellite Content Server. It also provides several global-level functions that provide developers with control over the contents and the properties of the page request.


Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 11]
This package contains the data of the current page request, and renders it for the Sitellite Content Server. It also provides several global-level functions that provide developers with control over the contents and the properties of the page request.



[ Top ]


Class Variables

$headers = array ()

[line 15]

List of HTTP headers to be sent with the document. @see addHeader()


Type:   mixed


[ Top ]

$meta = array ()

[line 22]

List of metadata attributes, which can be rendered as HTML meta tags using the makeMeta() method. To render them into your XT templates, simply add an xt:var tag with the name "makeMeta".


Type:   mixed


[ Top ]

$scripts = array ()

[line 29]

List of javascript scripts, which can be rendered as HTML script tags using the makeJavascript() method. To render them into your XT templates, simply add an xt:var tag with the name "makeJavascript".


Type:   mixed


[ Top ]

$styles = array ()

[line 34]

Array used to prevent duplicate loading of stylesheets.


Type:   mixed


[ Top ]



Class Methods


constructor Document [line 42]

Document Document( [array $data = array ()])

Constructor method. If $data is passed to the constructor, it will pass the $data on to the set() method.



Parameters:

array   $data   hash

[ Top ]

method addHeader [line 73]

void addHeader( string $header)

Adds an HTTP header to send when compile() is called.



Parameters:

string   $header  

[ Top ]

method addLink [line 178]

void addLink( string $rel, string $type, string $href, [string $charset = false], [string $hreflang = false], [mixed $name = false])

Adds a link tag to the global template.



Parameters:

string   $rel  
string   $type  
string   $href  
string   $charset  
string   $hreflang  

[ Top ]

method addMeta [line 93]

void addMeta( string $key, string $value, [mixed $name = 'name'])

Adds a metadata property to the global template.



Parameters:

string   $key  
string   $value  

[ Top ]

method addScript [line 116]

void addScript( string $script)

Adds a script to the global template.



Parameters:

string   $script  

[ Top ]

method addStyle [line 140]

void addStyle( string $style)

Adds a stylesheet to the global template.



Parameters:

string   $style  

[ Top ]

method compile [line 203]

string compile( )

"Compiles" the document. This includes sending any headers, checking isExternal(), then calling useTemplate() to render the document to the appropriate template.



[ Top ]

method getSection [line 428]

string getSection( )

Returns the section name of the current page, or false if the page is

not in any section. A section is a page that has its 'is_section' property set to true in $menu, and is set under the 'Properties' tab of the Sitellite web page editor in the field named 'Is This a Section Index?'. Section pages differ from ordinary pages in that their template setting (also under the 'Properties' tab) will inherit to all child pages, unless those pages explicitly declare their own template.




[ Top ]

method getTitle [line 452]

string getTitle( [string $page = false])

Gets the title of the current or the specified page.



Parameters:

string   $page  

[ Top ]

method isExternal [line 250]

void isExternal( )

Checks for an $external property of the document object, which if found is understood to represent an external document that this object is actually an alias of, and so it will forward the request on to that document.



[ Top ]

method isParent [line 468]

boolean isParent( string $parent)

Determines whether the specified page ID is a parent of the current page.



Parameters:

string   $parent  

[ Top ]

method makeJavascript [line 165]

string makeJavascript( )

Note: Deprecated in favour of XT's automatic tag binding capabilities.

Compiles the javascript of the current document into HTML script tags, which are returned as one big XHTML-compliant string.




[ Top ]

method makeMeta [line 107]

string makeMeta( )

Note: Deprecated in favour of XT's automatic tag binding capabilities.

Compiles the metadata properties of the current document into HTML meta tags, which are returned as one big XHTML-compliant string.




[ Top ]

method sendHeaders [line 81]

void sendHeaders( )

Sends all HTTP headers associated with the current document.

Called by compile() automatically.




[ Top ]

method set [line 54]

void set( [array $data = array ()])

Sets properties of the current Document object, such as title, id, body, etc.



Parameters:

array   $data   hash

[ Top ]

method useTemplate [line 290]

string useTemplate( )

Determines which template to use to render the document for output to the visitor. The template is chosen based on the following conditions:

  • Templates all live in inc/html in individual template set directories (ie. themes). The template set can be specified with page_template_set(), or via the default_template_set configuration option.
  • The $cgi->mode value, which defaults to "html" if unspecified
  • The $template property of this object is appended to the mode like this: html.index.tpl where html is the mode and index is the $template value. The template can be specified with the page_template() function, or via the default_template configuration option.
  • If that document is not found, we then check for such a document based on the names of parent documents in the hierarchy, but only those that are designated as section roots. Each of these is then used as a replacement for the $template property.
  • If none is found, then the default html.{default_template}.tpl is used, where html is the mode.
Note that the templates are always in XT format. For info on the XT template language, see the class documentation under XML/XT at sitellite.org/docs




[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:24 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2