to vouksh: I expanded your functions a bit:
<?php
function xhtmlHighlightString($str,$return=false) {
$hlt = highlight_string(stripslashes($str), true);
$fon = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $hlt);
$ret = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $fon);
if($return)
return $ret;
echo $ret;
return true;
}
function xhtmlHighlightFile($path,$return=false) {
$hlt = highlight_file($path, true);
$fon = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $hlt);
$ret = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $fon);
if($return)
return $ret;
echo $ret;
return true;
}
?>