We all love php code so I thought I would try and add an option in the commenting system so you can post php code without any problems.
Let’s just say it was a bitch to code!
I also included some basic bb code. I started with the basic bb code. To include the php highlighting it made the code three times the size!! argh and it only works once per post. Oh well. It’s better than nothing.
You better post heaps of php code now ;)
Okay php formatting should work here now too:
[code]function bbcode($content) {
$text = $content;
$text = htmlentities($text);
$search = array ("", "", "", "", "[u]", "[/u]", "™");
$replace = array ("<b>", "</b>", "<i>", "</i>", "<u>", "</u>", "");
$text = str_replace($search, $replace, $text);
return $text;
} [/code]
Copyright © Michael Dale 2004.
Page generated in 0.0100 seconds FreeBSD Powered
Background on style 5 is used from squidfingers How are we going? 3 queries
Right an example!
my old BB old
[code]function bbcode($content) {
$text = $content;
$text = htmlentities($text);
$search = array ("", "", "", "", "[u]", "[/u]", "™");
$replace = array ("<b>", "</b>", "<i>", "</i>", "<u>", "</u>", "™");
$text = str_replace($search, $replace, $text);
return $text;
} [/code]
1: Comment by dale - Sun, 11 Jul 2004 12:19:42 EST
Ok strange sometimes the colours don't show up!:S
Okay. Done some searching highlight_string() is buggy ;) So it isn't my code.
http://bugs.php.net/bug.php?id=27901
2: Comment by dale - Sun, 11 Jul 2004 14:22:19 EST
riight is it meant to work? Because it doesnt (at the moment)
3: Comment by ucosty - Sun, 11 Jul 2004 16:18:21 EST
aah it does now. weird.
4: Comment by same guy as the poster above - Sun, 11 Jul 2004 16:18:54 EST
aah it does now. weird.
5: Comment by same guy as the poster above - Sun, 11 Jul 2004 16:19:05 EST
Found a semi-bug in your comment system. if you refresh the page after posting it will re-post your message. This is not good because refreshing a page and waiting for more ppl to post is an integral component to online messaging.
6: Comment by ucosty - Sun, 11 Jul 2004 16:20:37 EST
its not really a bug, you are resending the post information. The same thing happens on other forums. Instead of pressing F5, just click on the url in the link bar and press enter. Although I will look into fixing this. I have an idea.
7: Comment by dale - Sun, 11 Jul 2004 16:28:47 EST
Yeah okay I'd call it a bug. Now fixed.
8: Comment by dale - Sun, 11 Jul 2004 16:32:07 EST
nice… i think
9: Comment by ucosty - Sun, 11 Jul 2004 19:54:59 EST
urls become clickable
[b]place text in bold[/b]
[i]place text in italics[/i]
[quote]place text in a quote[/quote]