Page

Represents a web page.  This class is primarily concerned with making sure that the things in the HEAD part of the page are set up correctly.

Inherits

LnBlogObject

Events

OnInitFired when a page object is first created.
InitCompleteFired after object initialization is complete.
OnOutputFired when processing for HTML output starts.
OutputCompleteFired after the HTML output has been performed.
Summary
PageRepresents a web page.
Properties
display_objectHolds a reference to the primary object which is displayed on this page.
doctypeString holding the DOCTYPE for the page.
titleA string used for the page title.
mime_typeRepresents the MIME type of the page.
charsetHolds the character encoding to use for the page.
Functions
setDisplayObjectSets the object which the page is currently displaying.
addStylesheetAdds style sheets to be link into the page.
addInlineStylesheetAdds style sheets to be added inline into the page.
addLinkAdds a generic link element to the page header.
addRSSFeedAdds an RSS feed to the link elements of the page header.
addScriptAdds a script file to the header of the page.
addInlineScriptAdds an inline script to the header of the page.
addScriptFirstLike addScript, except adds the script at the beginning of the list of scripts to be inserted.
addInlineScriptFirstLike addScriptFirst, except for inline scripts.
addMetaAdds a META item to the page.
addHeaderAdd an item to the HTTP header for the page.
redirectRedirect to another page.
refreshRefresh the page.
displayDisplays the page, i.e.

Properties

display_object

Holds a reference to the primary object which is displayed on this page.  The type of object will vary from page to page and may be set to false on some pages.  For most pages, it will be the current Blog object, but BlogEntry and Article object are also common.

doctype

String holding the DOCTYPE for the page.  Should normally be set using a named constant.

title

A string used for the page title.

mime_type

Represents the MIME type of the page.

charset

Holds the character encoding to use for the page.

Functions

setDisplayObject

public function setDisplayObject(&$ref)

Sets the object which the page is currently displaying.

Parameters

refA reference to the object to set.

addStylesheet

public function addStylesheet()

Adds style sheets to be link into the page.

Parameters

Takes a variable number of string parameters, each representing the filename of a CSS file.

addInlineStylesheet

public function addInlineStylesheet()

Adds style sheets to be added inline into the page.

Parameters

Takes a variable number of string parameters, each containing the CSS code to use for the inline styles.

addLink

public function addLink($attribs)

Adds a generic link element to the page header.

Parameters

attribsAn associative array, with each key corresponding to an attribute of the link with the corresponding value as the value.

addRSSFeed

public function addRSSFeed($href,
$type,
$title)

Adds an RSS feed to the link elements of the page header.

Parameters

hrefThe URL of the feed file.
typeThe MIME type of the feed, e.g. application/xml or application/rss+xml
titleThe title for the feed.

addScript

public function addScript($href,  
$type = "text/javascript")

Adds a script file to the header of the page.

Parameters

hrefThe URL of the script file.
typeOptional MIME type of the script.  The default is text/javascript.

addInlineScript

public function addInlineScript($text,  
$type = "text/javascript")

Adds an inline script to the header of the page.

Parameters

textThe text of the script to add inline.
typeOptional MIME type of the script.  The default is text/javascript.

addScriptFirst

public function addScriptFirst($href,  
$type = "text/javascript")

Like addScript, except adds the script at the beginning of the list of scripts to be inserted.  Use this for initialization of configuration scripts that need to run before other things.

addInlineScriptFirst

public function addInlineScriptFirst($text,  
$type = "text/javascript")

Like addScriptFirst, except for inline scripts.

addMeta

public function addMeta($content,  
$name = false,
$httpequiv = false)

Adds a META item to the page.

Parameters

contentThe content of the meta tag.
nameOptional name attribute.
httpequivOptional http-equiv attribute.

addHeader

public function addHeader($name,
$content)

Add an item to the HTTP header for the page.

Parameters

nameThe header name.
contentThe content of the header.

redirect

public function redirect($url)

Redirect to another page.

Parameters

urlThe target URL to which to redirect.

refresh

public function refresh($url,  
$delay = )

Refresh the page.

Parameters

urlThe URL of the page to refresh.
delayOptional delay of refresh.  Default is 0.

display

public function display($page_body,  
$blog = false)

Displays the page, i.e. sends it to the browser.

public function setDisplayObject(&$ref)
Sets the object which the page is currently displaying.
public function addStylesheet()
Adds style sheets to be link into the page.
public function addInlineStylesheet()
Adds style sheets to be added inline into the page.
public function addLink($attribs)
Adds a generic link element to the page header.
public function addRSSFeed($href,
$type,
$title)
Adds an RSS feed to the link elements of the page header.
public function addScript($href,  
$type = "text/javascript")
Adds a script file to the header of the page.
public function addInlineScript($text,  
$type = "text/javascript")
Adds an inline script to the header of the page.
public function addScriptFirst($href,  
$type = "text/javascript")
Like addScript, except adds the script at the beginning of the list of scripts to be inserted.
public function addInlineScriptFirst($text,  
$type = "text/javascript")
Like addScriptFirst, except for inline scripts.
public function addMeta($content,  
$name = false,
$httpequiv = false)
Adds a META item to the page.
public function addHeader($name,
$content)
Add an item to the HTTP header for the page.
public function redirect($url)
Redirect to another page.
public function refresh($url,  
$delay = )
Refresh the page.
public function display($page_body,  
$blog = false)
Displays the page, i.e.
A base object which is event-aware, i.e.
Close