Display PHP Code BBCode
Posted: Tue Mar 14, 2006 8:26 am
I am working on making a BBCode type function
to display php code and am stuck so far.
What I got is:
which does correctly display the php code within the tags,
however it also highlights anything else within the total results
and does not limit to just within the tags.
and the <div> </div> shows at very bottom with the
1 being only thing inside it.
If I take away the highlight_string():
then it displays the Tagged Results within the <div> perfectly
however..(of course) any actual php code with the results isnt well-formed.
How to correct this?
to display php code and am stuck so far.
What I got is:
Code: Select all
function phpTags($myphp)
{
$myphp = preg_replace("#\[php\](.*?)\[/php\]#si", "\\1", $myphp);
$showmyphp = "<div style='border: solid 1px'>". highlight_string($myphp) ."</div>";
return($showmyphp);
}however it also highlights anything else within the total results
and does not limit to just within the tags.
and the <div> </div> shows at very bottom with the
1 being only thing inside it.
If I take away the highlight_string():
then it displays the Tagged Results within the <div> perfectly
however..(of course) any actual php code with the results isnt well-formed.
How to correct this?