note 47638 added to function.tidy-construct

From: Date: Tue, 23 Nov 2004 17:37:59 +0000
Subject: note 47638 added to function.tidy-construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-80935@lists.php.net to get a copy of this message
The object-oriented approach to using tidy is woefully under-documented here, but a quick get_class_methods( 'tidy' ) will tell you what methods are available. On my PHP-5.0.2 system, I get the following list of methods: cleanRepair parseFile parseString repairString repairFile diagnose getRelease getConfig getStatus getHtmlVer isXhtml isXml root head html body __construct This implies that an example of tidy usage might be: <?php // $file is the path to the unclean document // $clean is the tidy'ed document $config = array( 'output-xhtml'=>TRUE, 'doctype'=>'loose', 'logical-emphasis'=>TRUE, 'enclose-block-text'=>TRUE, 'add-xml-space'=>TRUE, 'alt-text'=>'image' ); $myTidy = new tidy( $file, $config ); $myTidy->cleanRepair(); $clean = $myTidy->root(); ?> Note that using purely OO tidy, you can't specify a custom configuration without loading the document from a file, since the config array must be passed to the constructor, and the constructor won't accept NULL for the filename parameter. ---- Manual Page -- http://www.php.net/manual/en/function.tidy-construct.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47638 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47638&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47638&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80935) next »