Previous | Up | Next |
Container | Container | HTMLagClass |
This class is the main tag class for all XML tags that phpHtmlLib supports.
Each XML tag is broken down into it's name, attributes, content and an optional closing tag. This is also true for HTML tags.
The constructor of the XML tag object has 3 main parameters. The first parameter is the name of the tag to create. The second parameter is an array of key value pairs that make up the attributes and values for the tag. The third parameters is an infinite list of parameters that will make up the content portion of the tag.
$test = new XMLTagClass('foo', array('test' => 1), 'some content'); print $test->render();
Output:
<foo test="1">some content</foo>
The alternative way to create the same xml tag can be accomplised with a call to xml_tag().
$test = xml_tag('foo', array('test' => 1), 'some content'); print $test->render();
Output:
<foo test="1">some content</foo>
The XMLTagClass automatically determines if the closing tag is needed. If there is content in the tag, then a closing tag is built, otherwise it closes the tag in the open tag. NOTE: you can force a close tag to be required by defining a child of the XMLTagClass and setting the flag the forces the close tag.
$test = xml_tag('foo', array('test' => 1)); print $test->render();
Output:
<foo test="1" />
Previous | Up | Next |
Container | Container | HTMLagClass |
Documentation generated on Thu, 11 Oct 2007 12:05:14 -0700 by phpDocumentor 1.4.0