3 * File containing the Example1.php,
4 * PACKAGE DOMBasic - Generation PHP FILE for demostration purpose
8 * @copyright Copyright (C) 2014-2020 Juan Jose Guerra Haba. All rights reserved.
9 * @license http://www.jumla-droid.com/licenses/new_bsd New BSD License
13 //$ruta=realpath( dirname(realpath( dirname(__FILE__) ) ) )."/../DOM_element.php";
14 $ruta="../DOM_element.php";
18 $document=new DOM_element('document');
19 $document->setTag('');
20 $conf=array( "TYPE"=>"document", "DESC"=>"document DOM",
21 "OPEN_TAG_LEFT"=>"", "OPEN_TAG_RIGHT"=>"", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
22 $document->setConfiguration($conf);
24 $doctype=new DOM_element("doctype");
25 $doctype->setTag("DOCTYPE");
26 $conf=array( "TYPE"=>"doctype", "DESC"=>"Tipo de Documento (DTD)",
27 "OPEN_TAG_LEFT"=>"<!", "OPEN_TAG_RIGHT"=>">", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
28 $doctype->setConfiguration($conf);
29 //IGUALAR UNA CLAVE A NULL SIGNIFICA UNA CLAVE SIN VALOR
31 $doctype->addAttrib('PUBLIC',null); //$doctype->PUBLIC=null;
32 //COMENZAR UNA CLAVE POR '_null' significa un atributo sin clave (doctype) (SOLO VALOR)
33 $doctype->addAttrib("_null1", "-//W3C//DTD XHTML 1.0 Transitional//EN");
34 $doctype->_null2="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
36 $html=new DOM_element('html');
37 $html->setTag("html");
38 $html->xmlns="http://www.w3.org/1999/xhtml";
39 $html->addAttrib("xml:lang", $language);
40 $html->lang=$language;
42 $head=new DOM_element('head');
43 $head->setTag("head");
45 $meta1=new DOM_element("meta1");
46 $meta1->setTag("meta");
47 $conf=array( "TYPE"=>"meta", "DESC"=>"meta-tag HTML",
48 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>" />", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
49 $meta1->setConfiguration($conf);
50 $meta1->addAttrib("http-equiv", "Content-Type")->addAttrib("content", 'text/html; charset=utf-8');
52 $title=new DOM_element('title');
53 $title->setTag('title')->setText("ARCHIVO DE PRUEBAS PARA POO-PHP");
55 $link1=new DOM_element("link1");
56 $link1->setTag("link");
57 $conf=array( "TYPE"=>"link", "DESC"=>"link-resource HTML",
58 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>" />", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
59 $link1->setConfiguration($conf);
60 $link1->addAttrib("type", "image/x-icon")->addAttrib("rel", "shortcut icon")->addAttrib("href", "favicon.png");
62 $link2=new DOM_element("link2");
63 $link2->setTag("link");
64 $conf=array( "TYPE"=>"link", "DESC"=>"link-resource HTML",
65 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>" />", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
66 $link2->setConfiguration($conf);
67 $link2->addAttrib("type", "text/css")->addAttrib("rel", "stylesheet");
68 $link2->addAttrib("href", "http://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.css");
70 $style1=new DOM_element("style1");
71 $style1->setTag("style")->type="text/css";
79 border: 1px ridge coral;
86 border: 1px solid gray;
88 box-shadow:4px 6px 8px;
93 img:hover{ width:84%;}"
96 $script1=new DOM_element("script1");
97 $script1->setTag("script")->type="text/javascript";
98 $conf=array( "TYPE"=>"link", "DESC"=>"link-resource HTML",
99 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>">", "CLOSE_TAG_LEFT"=>"</", "CLOSE_TAG_RIGHT"=>">" );
100 $script1->setConfiguration($conf);
101 $script1->src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js";
103 $script2=new DOM_element("script2");
104 $script2->setTag("script")->type="text/javascript";
106 window.addEvent(\"domready\", function() {
107 $(\"container\").highlight(\"#AAAA00\");
111 $head->setChildren(array($meta1, $title, $link1, $link2, $style1, $script1, $script2));
113 $body=new DOM_element('body');
114 $body->setTag("body");
116 $h1=new DOM_element('h1_1');
118 $h1->setText('EXAMPLE1 :: Paquete DOMBasic <br /><small style="color:#666666;">- Generación de archivo HTML para propósitos de demostración <br /><small><a href="mailto:dinertron@gmail.com">guerraTron - 2014</a></small></small>');
120 $div1=new DOM_element('div1');
121 $div1->setTag("div")->id="container";
122 $div1->setText('<hr />"El fondo de este DIV resaltará dinámicamente mediante Javascript [Mootools]"<hr />');
124 $div2=new DOM_element('div2');
125 $div2->setTag("div")->id="container2";
126 $div2->setText('Pulsar en la primera imágen de Lego<br />');
128 $img1=new DOM_element('img1');
129 $conf=array( "TYPE"=>"img", "DESC"=>"image-resource HTML",
130 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>"/>", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
131 $img1->setConfiguration($conf);
132 $img1->setTag("img")->addAttribs(array("src"=>"./img1.png",
133 "alt"=>"img1.png - Legotron 1",
134 "title"=>"Legotron 1",
135 "onclick"=>"javascript: alert('LegoTron 1');"));
137 $img2=new DOM_element('img2');
138 $conf=array( "TYPE"=>"img", "DESC"=>"image-resource HTML",
139 "OPEN_TAG_LEFT"=>"<", "OPEN_TAG_RIGHT"=>"/>", "CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" );
140 $img2->setConfiguration($conf);
141 $img2->setTag("img")->addAttribs(array("src"=>"./img2.png",
142 "alt"=>"img2.png - Legotron 2",
143 "title"=>"Legotron 2"));
144 $div2->addChildren(array($img1, $img2));
145 $body->setChildren(array( $h1, $div1, $div2 ));
147 $html->setChildren(array($head, $body));
149 $document->addChild($doctype)->addChild($html);
153 echo $document->toHTML();