PHP Classes

DOM HTML Element: Manipulate HTML page elements using DOM Document

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 343 All time: 7,056 This week: 455Up
Version License PHP version Categories
dom-html-element 1.0GNU General Publi...5.0HTML, PHP 5
Description 

Author

This class can manipulate HTML page elements using DOM Document.

It extends the DOMDocument class to wrap an HTML page element of a given type.

The class provides means to compose HTML document elements by providing the same functions as the DOMElement class including appending child elements also of this class.

The HTML code of the resulting document excerpt can be returned as a single string.

Picture of Everton da Rosa
  Performance   Level  
Name: Everton da Rosa <contact>
Classes: 17 packages by
Country: Brazil Brazil
Age: 43
All time rank: 78756 in Brazil Brazil
Week rank: 286 Up14 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 3x

Example

<html>
    <head>
        <title>HTMLElement test</title>
    </head>
    <body>
        <?php

       
require_once 'htmlelement.class.php';

       
$div = new HTMLElement('div');//create a main HTMLElement
       
$p = new HTMLElement('p');//create other HTMLElement
       
$p->appendChild(new DOMText('Test'));//append text to HTMLElement
       
$p->setAttribute('style', 'color: green');
       
$div->appendChild($p);//append child to main HTMLElement
       
$div->appendChild(new DOMElement('p', 'It\'s Work!'));//append a DOMElement to main HTMLElement
       
$div->setAttribute('style', 'color: red');
       
$code = $div->getCode();//get HTML code
       
echo $code;//show HTMLElement
       
highlight_string($code);//show source-code

       
?>
</body>
</html>


  Files folder image Files  
File Role Description
Plain text file htmlelement.class.php Class Main class file
Accessible without login Plain text file index.php Example Example of use

 Version Control Unique User Downloads Download Rankings  
 0%
Total:343
This week:0
All time:7,056
This week:455Up