note 89334 modified in tidy.examples.basic by danbrown
| From: | danbrown@php.net | Date: | Tue, 03 Mar 2009 20:55:42 +0000 |
| Subject: | note 89334 modified in tidy.examples.basic by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151419@lists.php.net to get a copy of this message | ||
Cleaning an html fragment (OO support seems to half-arsed for now)
This will ensure all tags are closed, without adding any html/head/body tags around it.
<?php
$tidy_config = array(
'clean' => true,
'output-xhtml' => true,
'show-body-only' => true,
'wrap' => 0,
);
$tidy = tidy_parse_string($html_fragment, $tidy_config, 'UTF8');
$tidy->cleanRepair();
echo $tidy;
?>
--was--
Cleaning an html fragment (OO support seems to half-arsed for now)
This will ensure all tags are closed, without adding any html/head/body tags around it.
<?
$tidy_config = array(
'clean' => true,
'output-xhtml' => true,
'show-body-only' => true,
'wrap' => 0,
);
$tidy = tidy_parse_string($html_fragment, $tidy_config, 'UTF8');
$tidy->cleanRepair();
echo $tidy;
?>
http://php.net/manual/en/tidy.examples.basic.php