PHP Classes
elePHPant
Icontem

Valid Markup: Convert the HTML output to XHTML using Tidy

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2008-05-02 (7 years ago) RSS 2.0 feedNot enough user ratingsTotal: 494 All time: 5,445 This week: 1,050Up
Version License PHP version Categories  
validmarkup 1.0MIT/X Consortium ...5HTML, XML, PHP 5
Description Author  

This is a very simple class that can convert the HTML output of a page to XHTML using the Tidy extension.

It starts output buffering using the ob_tidyhandler function as filter to make it regenerate the current script HTML output to make sure it is formatted as XHTML.

The class may set the DTD to one of several possible HTML and XHTML versions.

Picture of Vagharshak Tozalakyan
Name: Vagharshak Tozalakyan <contact>
Classes: 28 packages by
Country: Armenia Armenia
Age: 35
All time rank: 61 in Armenia Armenia
Week rank: 21 Down1 in Armenia Armenia Equal
Innovation award
Innovation award
Nominee: 7x

Details provided by the author  
INTRODUCTION
------------------------------------

ValidMarkup is a small helper class which uses 
the Tidy extension to clean and repair invalid 
HTML output according to W3 standards. The class 
also may be used to convert the HTML markup to 
XHTML and vice versa.


HOW TO USE
------------------------------------

Just construct the ValidMarkup object BEFORE any 
output in your script.

__construct(string $doctype)

Following doctypes may be used:

'HTML 4.01 Strict'
'HTML 4.01 Transitional' 
'HTML 4.01 Frameset' 
'XHTML 1.0 Strict'
'XHTML 1.0 Strict'
'XHTML 1.0 Strict'
'XHTML 1.1'
'HTML 3.2'
'HTML 2.0' 

If no doctype is specified then 'XHTML 1.0 Transitional' 
will be used. 

Please see "example.php" to get an example of usage.


REQUIREMENTS
------------------------------------

PHP 5, Tidy extension.
  Files folder image Files  
File Role Description
Plain text file class.ValidMarkup.php Class Class source
Accessible without login Plain text file example.php Example Example of usage
Accessible without login Plain text file readme.txt Doc. How to use

 Version Control Unique User Downloads Download Rankings  
 0%Total:494All time:5,445
 This week:0This week:1,050Up