I found the htmltidy function for smarty the other day and I am just wondering if someone got it working with Tidy in the root folder and not in the php on the server? We had that with phpwcms and it worked really great..Just cleaned it sweet!
This is how marcus did it..So I am thinking of implement it for CMSmadesimple..Could it be really hard or did someone do it already? No use of doing it again then!
Take care / Gnolen
Code: Select all
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.
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:
// 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);
}
}
4. open conf.inc.php -> you should find (or add)
Code:
$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
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 Wink
if you know more about this (performance, commands etc.) please tell us.
greetings marcus