General PHP - bbcode type system

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   General PHP - bbcode type system
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Hi all,

i've been trying to make a kind of bbcode system, but not suceeding, i was wondering how i could make the stuff inside [php] and [/php] highlighted, e.g. if it was in
<a href="blah">blah</a>[php]<?php echo "test"; ?>[/php]<br><br>Thanks for reading this etc...

heres my code that doens't work no wonder why it looks ridiculas...
function phpsyntax($text) {
while($in_code = ereg_replace('#(.*?)\[php\](.*?)\[/php\](.*?)#si', '$first_code = \'\\1\';', $text)) {
eval($in_code);
$out_code = highlight_string($first_code);
$full_output = "<center><table class=\"border\" width=\"400\"><tr><td width=\"400\"><center><b>Code</b></td></tr><tr><td width=\"400\">$out_code</td></tr></table></center>";
$text = preg_replace("#\[php\]$first_code\[/php\]#si", "$full_output", $text);
}
return $text;
}


Hope somebody can help icon_rolleyes.gif icon_mrgreen.gif

Gareth



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Awwwww, oh well, i guess some things i have to wait for!

Gareth




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum