PHP Classes

PHP HTML Writer: Compose and output HTML pages programmatically

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 217 All time: 8,299 This week: 67Up
Version License PHP version Categories
html-writer 2.0Freely Distributable5.3HTML, PHP 5
Description 

Author

This class can compose and output HTML pages programmatically.

It can add tags to the composition of a HTML page. The tags may have data and optional attributes. The class can close the last opened tag.

The class can buffer the page tags and return the whole page as a single string when the page composition is concluded.

Picture of Jean-Georges Estiot
  Performance   Level  

 

Example

<?php

require_once('class.html.php');

print(
"Example script for the html writer class<br><br>\n\n\n");

html::init();

html::tag('html');

html::tag('head');
html::tag('title','Example page for the HTML writer class');
html::close(); // head

html::tag('body');

html::add_attributes(array('type'=>'text', 'name'=>'text', 'size'=>'30', 'placeholder'=>'Enter your text here'));
html::single_tag('input');

html::close(); // body

html::close();//html

$out = html::get_buffer();

print(
$out);

print(
"\n<br><br>View this document's source to see the generated HTML");

?>


  Files folder image Files (6)  
File Role Description
HTML file class.html.api.html Doc. Methods summary for the html class
HTML file class.html.doc.html Doc. The first part of the class html documentation
Plain text file class.html.php Class The class file
Plain text file combined.js Data Javascript needed for proper viewing of the API docs
Plain text file example.php Example Example file for the html writer
Plain text file style.css Data CSS file needed for viewing the docs

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 Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:217
This week:0
All time:8,299
This week:67Up