Documentation is available at class_b_element.php
- <?php
- class b_document extends b_element {
- var $docType;
- function b_document( $type = 'transitional' ) {
- /*
- * NOTE: i've removed the namespace declarations, they are:
- * transitional: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
- * strict: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- * frameset: "http://www.w3.org/TR/html4/frameset.dtd"
- */
- if( $type == 'transitional' ) {
- $this->docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
- } else if( $type == 'strict' ) {
- $this->docType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">';
- } else if( $type == 'frameset' ) {
- $this->docType = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">';
- }
- parent::HTMLElement();
- }
- function to_html() {
- $return = "\n<?xml version='1.0' encoding='utf-8'?>\n";
- $return .= $this->docType;
- foreach( $this->childNodes as $node ) {
- $return .= $node->to_html();
- }
- return $return;
- }
- }
- class b_element extends HTMLElement {
- /*
- * b_element is an extension of the standard DOM interface which
- * allows DOM objects to be instantiated with 4 parameters:
- * $tag - same as standard DOM: specifies the type of node to create
- * $id - sets the node's id attribute
- * $init_val - can be either text or a child node. in the case of text it
- * appends a text node with the given value, in the case of
- * a child node it appends the child node
- * $attrs - an array of name:value attributes
- *
- * example: to create a new div with a title containing text 'hello world' and inline style declaration:
- * $layer = new b_elment( 'div', 'layer1', new b_element( 'h1', 'title1', 'hello world' ), array( 'style'=>'position:absolute;left:10px;top:10px' ) );
- */
- function b_element( $tag, $id = NULL, $init_val = NULL, $attrs = array() ) {
- //construct the parent DOM object
- parent::HTMLElement($tag);
- if( $id ) { $this->setAttribute( 'id', $id ); }
- if( $init_val ) { $this->appendChild( $init_val ); }
- $this->setAttributes( $attrs );
- }
- }
- ?>
Documentation generated on Tue, 24 May 2005 03:57:21 -0400 by phpDocumentor 1.3.0RC3