AnewtPage Class Reference

Class for building XHTML pages. More...

List of all members.

Public Member Functions

 __construct ()
 Create a new AnewtPage instance.
Stylesheet methods
These methods allow you to add stylesheets to the page.

 add_stylesheet ($node)
 Add a stylesheet node to the page.
 add_stylesheet_href ($href)
 Add an external stylesheet reference to the page.
 add_stylesheet_href_media ($href, $media)
 Add an external stylesheet reference to the page.
JavaScript methods
These methods allow you to add JavaScript to the page.

 add_javascript ($node)
 Add JavaScript to this page.
 add_javascript_src ($src)
 Add a JavaScript reference to this page for the given source file.
 add_javascript_content ($content)
 Add a JavaScript to this page for the given content.
Linking methods
These methods should be used to link other resources to this page.

 add_link ($node)
 Add a link element to this page.
 add_link_rss ($href, $title)
 Add a link to a RSS feed to this page.

Private Attributes

 $_content
 Page content.
 $_blocks = array()
 Associative array of blocks.
 $_links = array()
 List of link nodes.
 $_javascripts = array()
 List of JavaScript nodes.

Content methods

These methods should be used to add content to the page.

 append ($new_child)
 Append new content to this page.
 append_to ($name, $new_child)
 Append new content to a block on this page.
 get_block ($name)
 Get the contents of a block.

Output methods

 render ()
 Render this page into XHTML.
 flush ()
 Flush this page to the browser.
 build_content_type_charset ()
 Build a content type and character set string.


Detailed Description

Class for building XHTML pages.

Definition at line 17 of file page.lib.php.


Member Function Documentation

AnewtPage::add_stylesheet ( node  ) 

Add a stylesheet node to the page.

This function accepts either a AnewtXHTMLStyle or an AnewtXHTMLLink element, e.g. created by ax_stylesheet() or ax_stylesheet_href(). Usually you should use add_stylesheet_href() or add_stylesheet_href_media() instead.

Parameters:
$node A AnewtXHTMLStyle or AnewtXHTMLLink (referring to a stylesheet) node.
See also:
add_stylesheet_href

add_stylesheet_href_media

Definition at line 97 of file page.lib.php.

AnewtPage::add_stylesheet_href ( href  ) 

Add an external stylesheet reference to the page.

Parameters:
$href The location of the external stylesheet
See also:
add_stylesheet

add_stylesheet_href_media

ax_stylesheet_href

Definition at line 113 of file page.lib.php.

AnewtPage::add_stylesheet_href_media ( href,
media 
)

Add an external stylesheet reference to the page.

Parameters:
$href The location of the external stylesheet
$media The media type for which this stylesheet is intended, e.g. print or screen.
See also:
add_stylesheet

add_stylesheet_href

ax_stylesheet_href_media

Definition at line 132 of file page.lib.php.

AnewtPage::add_javascript ( node  ) 

Add JavaScript to this page.

This function accepts a AnewtXHTMLScript node, e.g. one created using ax_javascript(). Use the add_javascript_src() and add_javascript_content() methods to easily add stylesheets to the page without creating the node yourself.

Parameters:
$node A AnewtXHTMLScript node.
See also:
add_javascript_src

add_javascript_content

Definition at line 160 of file page.lib.php.

AnewtPage::add_javascript_src ( src  ) 

Add a JavaScript reference to this page for the given source file.

Parameters:
$src Source of the JavaScript file

Definition at line 172 of file page.lib.php.

AnewtPage::add_javascript_content ( content  ) 

Add a JavaScript to this page for the given content.

Parameters:
$content Scripts contents.

Definition at line 183 of file page.lib.php.

AnewtPage::add_link ( node  ) 

Add a link element to this page.

Parameters:
$node A AnewtXHTMLLink node.
See also:
AnewtPage::add_link_rss

AnewtXHTMLLink

ax_link

Definition at line 207 of file page.lib.php.

AnewtPage::add_link_rss ( href,
title 
)

Add a link to a RSS feed to this page.

Parameters:
$href The location of the RSS feed
$title The title used to refer to the RSS feed
See also:
AnewtPage::add_link

AnewtXHTMLLink

ax_link_rss

Definition at line 225 of file page.lib.php.

AnewtPage::append ( new_child  ) 

Append new content to this page.

For simple pages this method just adds some content to the page. For block-based pages, this method adds content to the default block.

Parameters:
$new_child The content to add. This is most likely an Anewt XHTML element instance, e.g. created by the ax_* functions from the XHTML module. Numerical arrays are also accepted.
See also:
append_to

Definition at line 252 of file page.lib.php.

AnewtPage::append_to ( name,
new_child 
)

Append new content to a block on this page.

This method can only be used for block-based pages.

Note that the specified block is not required to be specified in the blocks property, though in most cases it will be (if you want it to be rendered at least). In some custom situations where you build blocks by other means, i.e. using build_* methods on your page subclass, it might be helpful to use custom block names to act as temporary containers for the page content. The build_* methods can then retrieve the value and do something smart with it.

Parameters:
$name The name of the block to which the content should be added.
$new_child The content to add. This is most likely an Anewt XHTML element instance, e.g. created by the ax_* functions from the XHTML module. Numerical arrays are also accepted.
See also:
append

Definition at line 302 of file page.lib.php.

AnewtPage::get_block ( name  )  [protected]

Get the contents of a block.

This method returns the content of the block as an AnewtXMLDomNode instance, or null if no content was set for the requested block.

Parameters:
$name The name of the block to retrieve.
Returns:
An AnewtXMLDomNode instance or null if the block did not contain any content.

Definition at line 329 of file page.lib.php.

AnewtPage::render (  ) 

Render this page into XHTML.

This methods renders the whole page into a complete XHTML page. Usually you want to use flush() to output the page to the browser.

Returns:
The rendered page as a string.
See also:
AnewtPage::flush

Definition at line 369 of file page.lib.php.

AnewtPage::flush (  ) 

Flush this page to the browser.

This method renders the page into a XHTML string and outputs it to the browser along with the correct HTTP headers.

See also:
AnewtPage::render

Definition at line 552 of file page.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9