FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


preg_replace with highlight_string





roeenoy
hi all,
in the last days, i have been tring to make a system with BBCODE.. i want to make the content of [mycode] and [/mycode], in color in php.

i want to make it in preg_replace(there is no another way..)

i write this code:

Code:

$content = preg_replace( "#\[mycode\](.+?)\[/mycode\]#is", "XXXXXXXXX", $content ); 


but i have no idea what to write in XXXXXXXXX...
how i use in highlight_string ??

thanks
JayBee
do you know this project?
GeSHi - Generic Syntax Highlighter

and this
phpBB Syntax Highlighting MOD

I thing it could help you
roeenoy
thank you
roeenoy
it dont helped me so much..

can i get another help?

thanks
BlackSkad
Code:
$content = preg_replace( "#\[mycode\](.+?)\[/mycode\]#is", highlight_string ("\1", true), $content );


it could be \\1 instead of \1, I'm not sure...
roeenoy
this code is not good ..

sorry Sad
Ranfaroth
Code:
 preg_replace( "#\[mycode\](.*)\[/mycode\]#ise", "highlight_string ('$1', true)",$content) ;
Related topics
req: PHP to list files in directory, and link to them
Site Nav Suggestions...
How do you show HTML/PHP code on your website?
Echoing Titles
Search function
Editing static HTML pages and CSS in PHP
Adding <br /> to text area
UBB Code / Smiley Parsing
BB Codes
How to realize "BB-Code"
Undo htmlspecialchars
Complicated regular expression (for preg_replace)
Preg_Replace { tags }
preg_replace Problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.