Original geschrieben von Troublegum
http://www.vbulletin.com/forum/misc....bbcode#buttons
http://www.vbulletin.com/forum/misc....bbcode#buttons
wotan such meinte ein tutorial zum erstellen eines solchen codes, nicht wie man ihn anwendet
wotan such meinte ein tutorial zum erstellen eines solchen codes, nicht wie man ihn anwendet
(siehe hier - gut, das warst du nicht, du hast aber auch schonmal gefragt).
function highlight_code($string)
{
$php_content_start = explode("[ CODE]", $string);
$highlighted_code = $php_content_start[0];
$count_php_content_start = count($php_content_start);
for($i=1; $i<=$count_php_content_start; $i++)
{
$php_content = explode("[/ CODE]", $php_content_start[$i]);
$n_explode = explode("\n", $php_content[0]);
$n_count = count($n_explode);
for($x=1; $x<=$n_count; $x++)
{
$n[$i] .= $x.":";
if($x<$n_count)
$n[$i] .= "<br>";
}
$php_content[0] = str_replace("<br />", "", $php_content[0]);
$php_content[0] = str_replace(""", "\"", $php_content[0]);
$php_content[0] = str_replace("<", "<", $php_content[0]);
$php_content[0] = str_replace(">", ">", $php_content[0]);
$php_content[0] = str_replace("'", "'", $php_content[0]);
if($php_content[0])
{
ob_start();
highlight_string($php_content[0]);
$php_content[0] = ob_get_contents();
ob_end_clean();
$highlight .= '<br></p>
<table>
<tr>
<td colspan="2"><p><b>Code:</b></p></td>
</tr>
<tr>
<td width="25"><p><code>'.$n[$i].'</code></p></td>
<td valign="top"><p>'.$php_content[0].'</p></td>
</tr>
</table>
<p>'.$php_content[1];
}
}
return $highlighted_code.$highlight;
}
$content = highlight_code($content);
EDIT:
Code struckturiert und unnötiges entfernt, sowie Zeilen Umgebrochen.

[/color]<-ForumSuche rettet Leben-> || <-Schau in den Codeschnippsels->
Kommentar