Ich habe diesen Code:
Den habe ich auch aus diesem Forum hier.
Ich habe jetzt das Problem das ich jetzt nichtmehr mit $string = htmlspecialchars($string); HTML deaktivieren kann wenn ich aus meiner Datenbank auslese weil dann auch der PHP code umgewandelt wird. Ich brauche aber die Code anzeigen funktion also BBcode das wenn ich [ Code ] <code> [ / Code ] das PHPscript angezeigt wird aber HTML deaktiviert ist.
Danke schonmal im voraus für jede Hilfe
Code:
<?php
//> PHP Syntax Farblich hervorheben.
function PHP($array)
{
//> Zeilen Zählen.
$Line = explode("\n",$array[1]);
for($cLine=1;$cLine<=count($Line);$cLine++)
{
$Lines .= " ".$cLine." <br>";
}
$string = $array[1];
//> Ausgabe von highlight_string() Puffern.
ob_start();
highlight_string(trim($string));
$Code = ob_get_contents();
ob_end_clean();
$Header = "<table cellspacing=\"0\" cellpadding=\"0\" align=\"center\" border=\"0\" width=\"90%\"><tr><td width=\"90%\" valgin=\"top\">"
."<div style=\"overflow: auto; height: ".(37+(count($Line)*16))."; width: 100%;\">"
."<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"BORDER: 1px SOLID #CCCCCC;\" width=\"100%\">"
."<tr><td colspan=\"3\" style=\"FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;FONT-SIZE:13px;FONT-WEIGHT:BOLD;COLOR:#FFFFFF;BACKGROUND-COLOR:#CCCCCC;\"> PHP-Code</td></tr>"
."<tr><td style=\"COLOR:#FFFFFF;BACKGROUND-COLOR:#CCCCCC;FONT-WEIGHT:BOLD;\" align=\"center\" width=\"20\" valign=\"top\"><code>"
.$Lines
."</code></td><td width=\"5\"> </td><td valign=\"top\" nowrap>";
$Footer = "</td></tr></table></div></td></tr></table>";
return $Header.$Code.$Footer;
}
?>
Den habe ich auch aus diesem Forum hier.
Ich habe jetzt das Problem das ich jetzt nichtmehr mit $string = htmlspecialchars($string); HTML deaktivieren kann wenn ich aus meiner Datenbank auslese weil dann auch der PHP code umgewandelt wird. Ich brauche aber die Code anzeigen funktion also BBcode das wenn ich [ Code ] <code> [ / Code ] das PHPscript angezeigt wird aber HTML deaktiviert ist.
Danke schonmal im voraus für jede Hilfe