Class for building XHTML pages.
Class for building XHTML pages.
__construct() ¶Create a new AnewtPage instance.
These methods allow you to add stylesheets to the page.
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.
$nodeA AnewtXHTMLStyle or AnewtXHTMLLink (referring to a stylesheet) node.
add_stylesheet_href($href) ¶Add an external stylesheet reference to the page.
$hrefThe location of the external stylesheet
add_stylesheet_href_media($href, $media) ¶Add an external stylesheet reference to the page.
$hrefThe location of the external stylesheet
$mediaThe media type for which this stylesheet is intended, e.g. print or screen.
These methods allow you to add JavaScript to the page.
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.
$nodeA AnewtXHTMLScript node.
add_javascript_src($src) ¶Add a JavaScript reference to this page for the given source file.
$srcSource of the JavaScript file
add_javascript_content($content) ¶Add a JavaScript to this page for the given content.
$contentScripts contents.
These methods should be used to link other resources to this page.
add_link_rss($href, $title) ¶Add a link to a RSS feed to this page.
$hrefThe location of the RSS feed
$titleThe title used to refer to the RSS feed
These methods should be used to add content to the page.
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.
$new_childThe 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.
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.
$nameThe name of the block to which the content should be added.
$new_childThe 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.
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.
$nameThe name of the block to retrieve.
An AnewtXMLDomNode instance or null if the block did not contain any content.
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.
The rendered page as a string.
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.
build_content_type_charset() [private] ¶Build a content type and character set string.
$_javascripts [private] ¶List of JavaScript nodes.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::__construct()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()