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 This week: 1All time: 7,053 This week: 560Up
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: 42
All time rank: 78856 in Brazil Brazil
Week rank: 106 Up7 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:1
All time:7,053
This week:560Up