1 |
jonen |
1.1 |
<refentry id="{@id}"> |
2 |
|
|
<refnamediv> |
3 |
|
|
<refname>XMLTagClass</refname> |
4 |
|
|
<refpurpose>This is the base tag class.</refpurpose> |
5 |
|
|
</refnamediv> |
6 |
|
|
<refsynopsisdiv> |
7 |
|
|
<refsynopsisdivinfo> |
8 |
|
|
<author> |
9 |
|
|
by Walter A. Boring IV |
10 |
|
|
<authorblurb>{@link mailto:waboring@3gstech.com}</authorblurb> |
11 |
|
|
</author> |
12 |
|
|
<copyright>March 2004, Walter A. Boring IV</copyright> |
13 |
|
|
<releaseinfo>phpHtmlLib 2.4.x</releaseinfo> |
14 |
|
|
</refsynopsisdivinfo> |
15 |
|
|
</refsynopsisdiv> |
16 |
|
|
<refsect1 id="{@id description}"> |
17 |
|
|
<title>Description</title> |
18 |
|
|
<para>This class is the main tag class for all XML tags that phpHtmlLib supports.</para> |
19 |
|
|
<para>Each XML tag is broken down into it's name, attributes, content and an optional |
20 |
|
|
closing tag. This is also true for HTML tags.</para> |
21 |
|
|
</refsect1> |
22 |
|
|
|
23 |
|
|
<refsect1 id="{@id constructor}"> |
24 |
|
|
<title>Creating an XML tag object.</title> |
25 |
|
|
<para> |
26 |
|
|
<para>The constructor of the XML tag object has 3 main parameters. |
27 |
|
|
The first parameter is the name of the tag to create. The second parameter is an array |
28 |
|
|
of key value pairs that make up the attributes and values for the tag. The third parameters is |
29 |
|
|
an infinite list of parameters that will make up the content portion of the tag.</para> |
30 |
|
|
<example> |
31 |
|
|
<![CDATA[$test = new XMLTagClass('foo', array('test' => 1), 'some content'); |
32 |
|
|
print $test->render();]]> |
33 |
|
|
</example> |
34 |
|
|
</para> |
35 |
|
|
|
36 |
|
|
<para>Output: |
37 |
|
|
<example><![CDATA[<foo test="1">some content</foo>]]></example> |
38 |
|
|
</para> |
39 |
|
|
|
40 |
|
|
</refsect1> |
41 |
|
|
|
42 |
|
|
<refsect1 id="{@id helper}"> |
43 |
|
|
<title>Creating an XML tag object with a function.</title> |
44 |
|
|
<para> |
45 |
|
|
<para>The alternative way to create the same xml tag can be accomplised with a call |
46 |
|
|
to xml_tag().</para> |
47 |
|
|
<example> |
48 |
|
|
<![CDATA[$test = xml_tag('foo', array('test' => 1), 'some content'); |
49 |
|
|
print $test->render();]]> |
50 |
|
|
</example> |
51 |
|
|
</para> |
52 |
|
|
|
53 |
|
|
<para>Output: |
54 |
|
|
<example><![CDATA[<foo test="1">some content</foo>]]></example> |
55 |
|
|
</para> |
56 |
|
|
|
57 |
|
|
</refsect1> |
58 |
|
|
|
59 |
|
|
<refsect1 id="{@id closetag}"> |
60 |
|
|
<title>Closing tag</title> |
61 |
|
|
<para> |
62 |
|
|
<para>The XMLTagClass automatically determines if the closing tag is needed. If there is content in the tag, |
63 |
|
|
then a closing tag is built, otherwise it closes the tag in the open tag. |
64 |
|
|
|
65 |
|
|
NOTE: you can force a close tag to be required by defining a child of the XMLTagClass and setting |
66 |
|
|
the flag the forces the close tag.</para> |
67 |
|
|
<example> |
68 |
|
|
<![CDATA[$test = xml_tag('foo', array('test' => 1)); |
69 |
|
|
print $test->render();]]> |
70 |
|
|
</example> |
71 |
|
|
</para> |
72 |
|
|
|
73 |
|
|
<para>Output: |
74 |
|
|
<example><![CDATA[<foo test="1" />]]></example> |
75 |
|
|
</para> |
76 |
|
|
</refsect1> |
77 |
|
|
|
78 |
|
|
</refentry> |