modification is for putting source code into a post for the world to
see. The idea is exactly the same as putting code into a post on a
phpBB2 forum. When posting code it has to be between
Expand|Select|Wrap|Line Numbers
- and
reading.
The problem I have is that I want the text between
Expand|Select|Wrap|Line Numbers
- and
cannot figure out how to go about this.
The function currently looks like this:
// Function : CodeParse
// Description : Searches for
Expand|Select|Wrap|Line Numbers
- and
// Arguments : $input - The text to work on
// Returns : The replaced text
// Author : SoulSniper
// Last Change : 2004-15-19
function CodeParse($inpu t){
$before = array("
Expand|Select|Wrap|Line Numbers
- ", "
$after = array('</span><table width="90%" cellspacing="1"
cellpadding="3" border="0" align="center"> <tr><td><span
class="small">< b>Code/Quote:</b></span></td></tr><tr><td
class="code">', '</td></tr></table><span class="blog_bod y">');
$return = str_replace($be fore, $after, $input);
return $return;
}
Before anyone mentions I know the text in $after is not escaped, when
I escaped it all the \'s appeared in the resulting html code so when I
unescaped them it worked fine..
Help anyone?