1 <?php rcs_id('$Id: HtmlElement.php,v 1.3 2002-01-21 16:51:12 carstenklapp Exp $');
3 * Code for writing XML.
5 require_once("lib/XmlElement.php");
10 class HtmlElement extends XmlElement
12 function printXML () {
13 if (!$this->_content) {
14 if (HTML::isEmptyTag($this->getTag())) {
15 echo "<" . $this->_startTag() . " />";
18 $this->pushContent('');
20 XmlElement::printXML();
25 function raw ($html_text) {
26 return new RawXML($html_text);
30 function link (/*...*/) {
31 $el = new HtmlElement('link');
32 $el->_init(func_get_args());
36 function style (/*...*/) {
37 $el = new HtmlElement('style');
38 $el->_init(func_get_args());
42 function script (/*...*/) {
43 $el = new HtmlElement('script');
44 $el->_init(func_get_args());
48 function noscript (/*...*/) {
49 $el = new HtmlElement('noscript');
50 $el->_init(func_get_args());
55 function a (/*...*/) {
56 $el = new HtmlElement('a');
57 $el->_init(func_get_args());
61 function img (/*...*/) {
62 $el = new HtmlElement('img');
63 $el->_init(func_get_args());
67 function h1 (/*...*/) {
68 $el = new HtmlElement('h1');
69 $el->_init(func_get_args());
73 function h1 (/*...*/) {
74 $el = new HtmlElement('h1');
75 $el->_init(func_get_args());
79 function h2 (/*...*/) {
80 $el = new HtmlElement('h2');
81 $el->_init(func_get_args());
85 function h3 (/*...*/) {
86 $el = new HtmlElement('h3');
87 $el->_init(func_get_args());
91 function h4 (/*...*/) {
92 $el = new HtmlElement('h4');
93 $el->_init(func_get_args());
97 function h5 (/*...*/) {
98 $el = new HtmlElement('h5');
99 $el->_init(func_get_args());
103 function h6 (/*...*/) {
104 $el = new HtmlElement('h6');
105 $el->_init(func_get_args());
109 function div (/*...*/) {
110 $el = new HtmlElement('div');
111 $el->_init(func_get_args());
115 function p (/*...*/) {
116 $el = new HtmlElement('p');
117 $el->_init(func_get_args());
121 function blockquote (/*...*/) {
122 $el = new HtmlElement('blockquote');
123 $el->_init(func_get_args());
127 function span (/*...*/) {
128 $el = new HtmlElement('span');
129 $el->_init(func_get_args());
133 function em (/*...*/) {
134 $el = new HtmlElement('em');
135 $el->_init(func_get_args());
139 function strong (/*...*/) {
140 $el = new HtmlElement('strong');
141 $el->_init(func_get_args());
145 function small (/*...*/) {
146 $el = new HtmlElement('small');
147 $el->_init(func_get_args());
151 function tt (/*...*/) {
152 $el = new HtmlElement('tt');
153 $el->_init(func_get_args());
157 function u (/*...*/) {
158 $el = new HtmlElement('u');
159 $el->_init(func_get_args());
163 function ul (/*...*/) {
164 $el = new HtmlElement('ul');
165 $el->_init(func_get_args());
169 function ol (/*...*/) {
170 $el = new HtmlElement('ol');
171 $el->_init(func_get_args());
175 function dl (/*...*/) {
176 $el = new HtmlElement('dl');
177 $el->_init(func_get_args());
181 function li (/*...*/) {
182 $el = new HtmlElement('li');
183 $el->_init(func_get_args());
187 function dt (/*...*/) {
188 $el = new HtmlElement('dt');
189 $el->_init(func_get_args());
193 function dd (/*...*/) {
194 $el = new HtmlElement('dd');
195 $el->_init(func_get_args());
199 function table (/*...*/) {
200 $el = new HtmlElement('table');
201 $el->_init(func_get_args());
205 function caption (/*...*/) {
206 $el = new HtmlElement('caption');
207 $el->_init(func_get_args());
211 function thead (/*...*/) {
212 $el = new HtmlElement('thead');
213 $el->_init(func_get_args());
217 function tbody (/*...*/) {
218 $el = new HtmlElement('tbody');
219 $el->_init(func_get_args());
223 function tr (/*...*/) {
224 $el = new HtmlElement('tr');
225 $el->_init(func_get_args());
229 function td (/*...*/) {
230 $el = new HtmlElement('td');
231 $el->_init(func_get_args());
235 function th (/*...*/) {
236 $el = new HtmlElement('th');
237 $el->_init(func_get_args());
241 function form (/*...*/) {
242 $el = new HtmlElement('form');
243 $el->_init(func_get_args());
247 function input (/*...*/) {
248 $el = new HtmlElement('input');
249 $el->_init(func_get_args());
253 function isEmptyTag($tag) {
254 global $HTML_TagProperties;
255 if (!isset($HTML_TagProperties[$tag]))
257 $props = $HTML_TagProperties[$tag];
258 return ($props & HTMLTAG_EMPTY) != 0;
262 define('HTMLTAG_EMPTY', 1);
264 $GLOBALS['HTML_TagProperties']
265 = array('area' => HTMLTAG_EMPTY,
266 'base' => HTMLTAG_EMPTY,
267 'basefont' => HTMLTAG_EMPTY,
268 'br' => HTMLTAG_EMPTY,
269 'col' => HTMLTAG_EMPTY,
270 'frame' => HTMLTAG_EMPTY,
271 'hr' => HTMLTAG_EMPTY,
272 'img' => HTMLTAG_EMPTY,
273 'input' => HTMLTAG_EMPTY,
274 'isindex' => HTMLTAG_EMPTY,
275 'link' => HTMLTAG_EMPTY,
276 'meta' => HTMLTAG_EMPTY,
277 'param' => HTMLTAG_EMPTY);
279 // (c-file-style: "gnu")
284 // c-hanging-comment-ender-p: nil
285 // indent-tabs-mode: nil