use TIDY with PHPWCMS
Posted: Tue 8. Mar 2005, 10:48
well, I try out the TIDY integration and it works very fast and fine at the moment. I'm not shure about the performance with high traffic or larger sites but anyway.
First TIDY is a free validator to check and transform your site to valid XHTML.
Oliver integrates this to validate the PHPWCMS output on the fly.
edit: exec command must work on your server!!
1. go to http://tidy.sourceforge.net/#binaries and download the app
if your site running under Linux choose LINUX/x86 else any other provided OS
2. upload tidy to any folder you want into your phpwcms directory
3. open index.php and go to line 140 and uncomment:
4. open conf.inc.php -> you should find (or add)
change the path on the second var $phpwcms["tidy_command"] on windows it could be C:\webroot\tidy\tidy.exe
after the filename you write the commands.
-cqm (don't know what this mean/find no documentation)
-utf8
-asxhtml (means it will validate XHTML)
and the you can notice a lot more functions with
--tidy-mark 0 (means tidy don't add a <meta generator="tidy..." /> tag)
--wrap 0 (don't wrap the sourcecode like in default settings after 68 chars)
there are a lot more commads you will find description here:
http://tidy.sourceforge.net/docs/quickref.html
http://www.perpetualpc.net/srtd_tidy.html
http://jnpassieux.chez.tiscali.fr/info/Tidy.php
sorry for my bad english, hope you understand
if you know more about this (performance, commands etc.) please tell us.
greetings marcus
First TIDY is a free validator to check and transform your site to valid XHTML.
Oliver integrates this to validate the PHPWCMS output on the fly.
edit: exec command must work on your server!!
1. go to http://tidy.sourceforge.net/#binaries and download the app
if your site running under Linux choose LINUX/x86 else any other provided OS
2. upload tidy to any folder you want into your phpwcms directory
3. open index.php and go to line 140 and uncomment:
Code: Select all
// EXPERIMENTAL
// now try to cleanup html code with tidy
if(isset($phpwcms['tidy']) && $phpwcms['tidy']) {
require_once ("include/inc_front/utf8.func.inc.php");
$tmp_tidy_file = PHPWCMS_ROOT.'/content/tmp/'.time().'_tidy_cleanup.html';
$tidy_written = entities_to_utf8($content['page_start'].$content["all"].$content['page_end']);
$tidy_written = write_textfile($tmp_tidy_file, $tidy_written);
$tidy_page_end = $content['page_end'];
if($tidy_written && filesize($tmp_tidy_file)){
//echo '<!-- '.$phpwcms['tidy_command'].' "'.$tmp_tidy_file.'" //-->';
@exec($phpwcms['tidy_command'].' "'.$tmp_tidy_file.'"', $tidy_return);
if(!isset($tidy_return[0])) {
if(filesize($tmp_tidy_file) && ($content['page_end'] = file_get_contents($tmp_tidy_file))) {
echo $content['page_start'] = '';
echo $content["all"] = '';
} else {
$content['page_end'] = $tidy_page_end;
}
}
unlink($tmp_tidy_file);
}
}
Code: Select all
$phpwcms["tidy"] = 1; //use tidy to cleanup rendered document
$phpwcms["tidy_command"] = '/www/your_root/tidy/tidy -cqm -utf8 -asxhtml -clean -numeric --wrap 0 --tidy-mark 0 --alt-text 1'; //use tidy to cleanup rendered document
after the filename you write the commands.
-cqm (don't know what this mean/find no documentation)
-utf8
-asxhtml (means it will validate XHTML)
and the you can notice a lot more functions with
--tidy-mark 0 (means tidy don't add a <meta generator="tidy..." /> tag)
--wrap 0 (don't wrap the sourcecode like in default settings after 68 chars)
there are a lot more commads you will find description here:
http://tidy.sourceforge.net/docs/quickref.html
http://www.perpetualpc.net/srtd_tidy.html
http://jnpassieux.chez.tiscali.fr/info/Tidy.php
sorry for my bad english, hope you understand
if you know more about this (performance, commands etc.) please tell us.
greetings marcus