Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 202 | All time: 8,464 This week: 39 |
Version | License | PHP version | Categories | |||
dom-basic 1.0 | BSD License | 5 | HTML, XML, PHP 5, Libraries |
Description | Author | |||
This package can create DOM documents in pure PHP. Innovation Award
|
<?php |
<a href="http://guerratron.github.io/DOMbasic"><img src="http://guerratron.github.io/DOMbasic/assets/DOMbasic_logo.png" title="DOMbasic GitHub page" alt="dombasic logo" /></a> <!--- %% ---> *DOMbasic. Juan José Guerra Haba - 2014 - dinertron@gmail.com dombasic-full@lists.osdn.me - dombasic-private@lists.osdn.me*
PHP package to create dynamic DOM elements. It follow the OOP paradigm, implemented SINGLETON patterns, magical methods, contains error control ('own exceptions'), chaining methods, optimized memory and resources, ...
More flexible and lighter than the native PHP. It allows you to create any document labeling: HTML, XHTML, XML, ... including any user-defined (this includes those who are yet to be implemented) that are based on hierarchies of tags, attributes and content; this You can be achieved simply by modifying the constants file specify, opening and closing tags and a couple of other modifications.
You can create complete websites that adhere to the standards validation of its structure. A tree harbor the only variable element created, this includes visible elements (BODY) and invisible (HEAD), static (HTML) and dynamic (SCRIPTS:. EG Javascript), elements and positioning structure (xHTML) or style (CSS) ...
Although there are other ways to achieve the same (text variables, other APIs, ...) This method is designed for flexibility and dynamism, performance and low resource consumption. Once you understand the mechanism and its syntax, saving time and effort, errors are minimized and DOM construction and automated cleaner is achieved. We all know the problems that can be generated when processing a Web page on the fly successive chaining 'Echo, print, ... " making sure that the headers are not sent in advance; these errors multiplied by a thousand if we use Frameworks or type CMS (Joomla, Wordpress, Drupal, ...)
They have been implemented utility functions that allow us to quickly convert theDOM* tree JSON text, HTML, XML, ... and vice versa. * Maintain tight control 'Exceptions' providing much information when debugging. Classes that follow theSINGLETON* pattern. * Contains methods 'constructor' and 'destructor' to optimize memory. Methods called magical (getter, setter, unset, clone, toString, ...*). Configuration file writable for the accommodation of the basic parameters ofINI DOM*. Chaining methods [NO GETTER*]. Programming entirely within the paradigmOOP*. * ... Other utility functions.
PHP* > 4 The modules that support for readingINI,JSONandXMLfiles, must be enabled inPHP*. * Having wanted to write code. jejejejj
1. You do not require installation.
Place the pakage in the desired route by which to call to instructions 'include' or 'require'. (obviously if it's in a compressed format before DECOMPRESS) We suggest creating a folder (for example DOM) and place it inside.
Load the main input class 'DOM_element' by 'include' or some variant clause:include_once, require ...* by example:
... require(realpath(dirname(__FILE__))."/DOM/DOM_element.php"); ...
After this, to creatingDOM* elements:
... $div1=new DOM_element('div1'); ...
* Add attributes and properties:
... $div1->setTag("div")->id="container"; ...
* Add content:
... $div1->setText("TEXT INTO 'container' DIV")->addChild($div2); ...
* Print:
... echo $div1->toHTML(); ...
* The normal flow for building a Web page would be: DOCTYPE -> HTML (HEAD -> BODY).
All this would contain the entire document. (SEE EXAMPLES FOR MORE FULL SHOW)
* DOCUMENT:
No special labels or attributes element is purely the DOM representation, the element tree, the container document in full:
`... $document=new DOM_element('document'); ...`
`... $document->setTag(''); ...`
`... $conf=array( "TYPE"=>"2", "DESC"=>"",
"OPEN_TAG_LEFT"=>"", "OPEN_TAG_RIGHT"=>"",
"CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" ); ...`
`... $document->setConfiguration($conf); ...`
* DOCTYPE:
This being another special element (it is an element of definition, structure and style), we should also do it using both special
opening tag but no closing and unnamed attributes:
`... $doctype=new DOM_element("doctype"); ...`
`... $doctype->setTag("DOCTYPE"); ...`
`... $conf=array( "TYPE"=>"doctype", "DESC"=>"Tipo de Documento (DTD)",
"OPEN_TAG_LEFT"=>"<!", "OPEN_TAG_RIGHT"=>">",
"CLOSE_TAG_LEFT"=>"", "CLOSE_TAG_RIGHT"=>"" ); ...`
`... $doctype->setConfiguration($conf); ...`
//STARTING A KEY FOR '_null' means an attribute without key (doctype)
`... $doctype->addAttrib("_null1", "-//W3C//DTD XHTML 1.0 Transitional//EN"); ...`
`... $doctype->_null2="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; //atributo asignado diréctamente ...`
_NOTE: Also keep in mind that not harbor any element._
* HTML:
Container of elements HEAD and BODY. Depending on the type of document to create (HTML 1.0, xHTML, HTML5, ...)
will implement those or other parameters:
`... $html=new DOM_element('html'); ...`
`... $html->setTag("html"); ...`
`... $html->xmlns="http://www.w3.org/1999/xhtml"; ...`
* HEAD:
Invisible element of page:
`... $head=new DOM_element('head'); ...`
`... $head->setTag("head")->addChild($title); ...`
* BODY:
Visual element of page:
`... $body=new DOM_element('body'); ...`
`... $body->setTag("body")->addChild($div1); ...`
* SEWING OF ELEMENTS:
`... $html->setChildren(array($html, $body)); ...`
`... $document->setChildren(array($doctype, $html)); ...`
* WEB PRINTING:
`... echo $document->toHTML(); ...`
NOTE: (SEE EXAMPLES IN THE 'EXAMPLES' FOLDER FOR A MORE FULL SHOW)
Files (229) |
File | Role | Description | ||
---|---|---|---|---|
assets (2 files) | ||||
DOCS (5 files, 2 directories) | ||||
examples (4 files) | ||||
exceptions (8 files) | ||||
util (3 files) | ||||
config.ini | Data | INI Data File | ||
DOM_attribs.php | Class | Aux. Class | ||
DOM_element.php | Class | Main Class | ||
DOM_Interface.php | Class | Main Interface | ||
DOM_textNode.php | Class | Child Class | ||
index.html | Doc. | web access page | ||
LICENSE | Lic. | GNU GPL v2 | ||
README.md | Doc. | Howto, instalation, ... mini-Help |
Files (229) | / | assets |
File | Role | Description |
---|---|---|
DOMbasic_logo.png | Icon | Logo pakage |
torotron_logo.png | Icon | Logo author |
Files (229) | / | DOCS |
File | Role | Description | ||
---|---|---|---|---|
html (93 files, 1 directory) | ||||
rtf (21 files) | ||||
LEEME.txt | Doc. | Spanish mini-Help | ||
license_bsd-3.txt | Doc. | NO-USE | ||
README.html | Doc. | mini-Help HTML | ||
README.txt | Doc. | English mini-Help Text Plain | ||
unlicense.txt | Doc. | NO-USE |
Files (229) | / | DOCS | / | html |
Files (229) | / | DOCS | / | html | / | search |
File | Role | Description |
---|---|---|
all_0.html | Doc. | Documentation |
all_0.js | Data | Auxiliary data |
all_1.html | Doc. | Documentation |
all_1.js | Data | Auxiliary data |
all_2.html | Doc. | Documentation |
all_2.js | Data | Auxiliary data |
all_3.html | Doc. | Documentation |
all_3.js | Data | Auxiliary data |
all_4.html | Doc. | Documentation |
all_4.js | Data | Auxiliary data |
all_5.html | Doc. | Documentation |
all_5.js | Data | Auxiliary data |
all_6.html | Doc. | Documentation |
all_6.js | Data | Auxiliary data |
all_7.html | Doc. | Documentation |
all_7.js | Data | Auxiliary data |
all_8.html | Doc. | Documentation |
all_8.js | Data | Auxiliary data |
all_9.html | Doc. | Documentation |
all_9.js | Data | Auxiliary data |
all_a.html | Doc. | Documentation |
all_a.js | Data | Auxiliary data |
all_b.html | Doc. | Documentation |
all_b.js | Data | Auxiliary data |
all_c.html | Doc. | Documentation |
all_c.js | Data | Auxiliary data |
all_d.html | Doc. | Documentation |
all_d.js | Data | Auxiliary data |
all_e.html | Doc. | Documentation |
all_e.js | Data | Auxiliary data |
all_f.html | Doc. | Documentation |
all_f.js | Data | Auxiliary data |
classes_0.html | Doc. | Documentation |
classes_0.js | Data | Auxiliary data |
classes_1.html | Doc. | Documentation |
classes_1.js | Data | Auxiliary data |
classes_2.html | Doc. | Documentation |
classes_2.js | Data | Auxiliary data |
close.png | Icon | Icon image |
functions_0.html | Doc. | Documentation |
functions_0.js | Data | Auxiliary data |
functions_1.html | Doc. | Documentation |
functions_1.js | Data | Auxiliary data |
functions_2.html | Doc. | Documentation |
functions_2.js | Data | Auxiliary data |
functions_3.html | Doc. | Documentation |
functions_3.js | Data | Auxiliary data |
functions_4.html | Doc. | Documentation |
functions_4.js | Data | Auxiliary data |
functions_5.html | Doc. | Documentation |
functions_5.js | Data | Auxiliary data |
functions_6.html | Doc. | Documentation |
functions_6.js | Data | Auxiliary data |
functions_7.html | Doc. | Documentation |
functions_7.js | Data | Auxiliary data |
functions_8.html | Doc. | Documentation |
functions_8.js | Data | Auxiliary data |
functions_9.html | Doc. | Documentation |
functions_9.js | Data | Auxiliary data |
functions_a.html | Doc. | Documentation |
functions_a.js | Data | Auxiliary data |
functions_b.html | Doc. | Documentation |
functions_b.js | Data | Auxiliary data |
functions_c.html | Doc. | Documentation |
functions_c.js | Data | Auxiliary data |
mag_sel.png | Icon | Icon image |
namespaces_0.html | Doc. | Documentation |
namespaces_0.js | Data | Auxiliary data |
nomatches.html | Doc. | Documentation |
search.css | Data | Auxiliary data |
search.js | Data | Auxiliary data |
searchdata.js | Data | Auxiliary data |
search_l.png | Icon | Icon image |
search_m.png | Icon | Icon image |
search_r.png | Icon | Icon image |
variables_0.html | Doc. | Documentation |
variables_0.js | Data | Auxiliary data |
variables_1.html | Doc. | Documentation |
variables_1.js | Data | Auxiliary data |
variables_2.html | Doc. | Documentation |
variables_2.js | Data | Auxiliary data |
variables_3.html | Doc. | Documentation |
variables_3.js | Data | Auxiliary data |
variables_4.html | Doc. | Documentation |
variables_4.js | Data | Auxiliary data |
Files (229) | / | DOCS | / | rtf |
Files (229) | / | examples |
File | Role | Description |
---|---|---|
comparation.php | Example | example php file |
example1.php | Example | example php file |
img1.png | Icon | image to example |
img2.png | Icon | example image |
Files (229) | / | exceptions |
File | Role | Description |
---|---|---|
DOMBasicAttribNotFoundException.php | Class | Exception Class |
DOMBasicAttribReadOnlyException.php | Class | Exception Class |
DOMBasicAutoloadException.php | Class | Exception Class |
DOMBasicElementNotFoundException.php | Class | Exception Class |
DOMBasicElementReadOnlyException.php | Class | Exception Class |
DOMBasicException.php | Class | Main Exception Class |
DOMBasicSingletonException.php | Class | Exception Class |
DOMBasicValueException.php | Class | Exception Class |
Files (229) | / | util |
File | Role | Description |
---|---|---|
INI.php | Class | Utility Class for read/write INI Files |
JsonIniXml.php | Aux. | Json Utility Class |
Utiles.php | Aux. | Utility Methods |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.