PHP-Code:
<?php
function codetable($code) {
ob_start();
highlight_string ($code);
$line = ob_get_contents();
ob_end_clean();
$line = explode ("\n", $line);
for ($i = 0; $i <= count ($line); $i++) {
if (!empty ($line[$i])) $str .= '<tr><td valign="top" style="border-right: #000000 1px solid">' . $i . '</td><td>' . $line[$i] . '</td></tr>';
}
return $str;
}
?>
<table style="padding-left: 2px; padding-right: 2px; width: 300px; border: #000000 1px solid">
<tr><td>
<?php
$content = "<?php
if (!strstr (\$_REQUEST[\"goto\"], 'http://')) header (\"Location: http://\" . \$_REQUEST[\"goto\"]);
else header (\"Location: \" . \$_REQUEST[\"goto\"]);
?>";
echo codetable($content);
?>
</td></tr>
</table>
wie man sieht möchte ich n highlight syntax und zeilennummerierung
edit: der $content is nur ein beispiel. das soll dann für ein portal eingesetzt werden