Quantcast

Maximum PC

It is currently Sat Jul 12, 2014 5:27 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: bb codes not working (bracket problem)
PostPosted: Fri Nov 12, 2004 7:04 pm 
8086
8086

Joined: Sat Nov 06, 2004 2:24 pm
Posts: 6
Location: http://twirp.net
so my code is here (i don't want to break the tables...)
the problem is that when i try to display something with [ and ] in it for coding,
like
Code:
[ ]


it displays
[ code ]
[ ]
[ /code ]
so i don't know what's wrong...
staring at it didn't seem to help much


Top
  Profile  
 
 Post subject: Re: bb codes not working (bracket problem)
PostPosted: Fri Nov 12, 2004 7:38 pm 
Bitchin' Fast 3D Z8000
Bitchin' Fast 3D Z8000
User avatar

Joined: Mon Jun 14, 2004 4:04 pm
Posts: 985
Location: Earth
Twirp wrote:
so my code is here (i don't want to break the tables...)
the problem is that when i try to display something with [ and ] in it for coding,
like
Code:
[ ]


it displays
[ code ]
[ ]
[ /code ]
so i don't know what's wrong...
staring at it didn't seem to help much


What exactly are you doing?

In phpBB, BB codes should have no spaces, hence:

Code:
  [b] Some text Here [/b]


Notice that there are no spaces between the brackets ([) and the actual letter. Spaces will make phpBB think that you're just typing in text.


Top
  Profile  
 
 Post subject:
PostPosted: Fri Nov 12, 2004 7:42 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
A work-around I've found for this is such:
For this forum, the text is black. What you need to do is to say, "[color =black ][[/color ]code]", without the weird spacing.

This shows up as:
[code]

Note that this can be used for other purposes, too.
Like bypassing the swear filter


Top
  Profile  
 
 Post subject:
PostPosted: Fri Nov 12, 2004 8:39 pm 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24222
Location: Granite Heaven
Kybo_Ren wrote:
Note that this can be used for other purposes, too.
Like bypassing the swear filter


That's an Efin' cool colour!


Top
  Profile  
 
 Post subject:
PostPosted: Sat Nov 13, 2004 1:22 pm 
8086
8086

Joined: Sat Nov 06, 2004 2:24 pm
Posts: 6
Location: http://twirp.net
In my mb that i made,
the bbcodes act up
when i try to put [ and ] inside of a bb code
it acts up with the coding
ie this page
as you can see i tried to put:
Don't put
[quote=YOU]
go to [ url=www.yoursite.com ]My Site! [ /url ] and click demo scripts, then go to management, then click Somehting. Join my forums too please!
[/quote]

but it doesn't display on the page


Top
  Profile  
 
 Post subject:
PostPosted: Thu Nov 18, 2004 9:54 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Jipstyle wrote:
Kybo_Ren wrote:
Note that this can be used for other purposes, too.
Like bypassing the swear filter


That's an Efin' cool colour!

Alright... for the record, I was the first person here to start doing that here (not that it is a big deal). Chumly caught me doing it in folding threads where I would say something nice and finish it off with some flavor. ;0

Hey, Jip.... wanna go climbing?
<splat> - oh, sorry 'bout that


Top
  Profile  
 
 Post subject:
PostPosted: Fri Nov 19, 2004 10:46 am 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24222
Location: Granite Heaven
Gadget wrote:
Hey, Jip.... wanna go climbing?
<splat> - oh, sorry 'bout that


Methinks you have safety issues. :P :lol:


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jan 06, 2005 6:35 am 
Bitchin' Fast 3D Z8000
Bitchin' Fast 3D Z8000
User avatar

Joined: Wed Jun 16, 2004 11:30 am
Posts: 368
Location: San Antonio, TX
Try the following code:

Code:
function bbcode_to_html($text){
   /*
   # Post parse
   # - parameter #1:                string $text, text to parse
   # - return                                        parsed text
   # - scope                                        public
   */
   //$text = str_replace("$", "$", $text);
   $text = nl2br($text);
   $search[0] = "#\[link\]([a-z]+?://){1}(.*?)\[/link\]#si";
   $replace[0] = '<a href="\1\2">\1\2</a>';
   $search[1] = "#\[link\](.*?)\[/link\]#si";
   $replace[1] = '<a href="http://\1">\1</a>';
   $search[2] = "#\[link=([a-z]+?://){1}(.*?)\](.*?)\[/link\]#si";
   $replace[2] = '<a href="\1\2">\3</a>';
   $search[3] = "#\[link=(.*?)\](.*?)\[/link\]#si";
   $replace[3] = '<a href="\1">\2</a>';
   $search[4] = "#\[email\](.*?)\[/email\]#si";
   $replace[4] = '<a href="mailto:\1">\1</a>';
   $search[5] = "#\[email=(.*?){1}(.*?)\](.*?)\[/email\]#si";
   $replace[5] = '<a href="mailto:\1\2">\3</a>';
   $search[6] = "#\[url\]([a-z]+?://){1}(.*?)\[/url\]#si";
   $replace[6] = '<a href="\1\2" target=_blank>\1\2</a>';
   $search[7] = "#\[url\](.*?)\[/url\]#si";
   $replace[7] = '<a href="http://\1" target=_blank>\1</a>';
   $search[8] = "#\[url=([a-z]+?://){1}(.*?)\](.*?)\[/url\]#si";
   $replace[8] = '<a href="\1\2" target=_blank>\3</a>';
   $search[9] = "/\[quote=(.*?)\](.*?)\[\/quote\]/si";
   $replace[9] = '<br /><div class=\'indent\'>Originally said by \1 ...<br /><br /><i>"\2"</i></div>';
   $search[10] = "#\[b\](.*?)\[/b\]#si";
   $replace[10] = '<b>\1</b>';
   $search[11] = "#\[i\](.*?)\[/i\]#si";
   $replace[11] = '<i>\1</i>';
   $search[12] = "#\[u\](.*?)\[/u\]#si";
   $replace[12] = '<u>\1</u>';
   $search[13] = "#\[img\](.*?)\[/img\]#si";
   $replace[13] = '<img src=\'\1\' alt=\'\' style=\'vertical-align:middle; border:0\' />';
   $search[14] = "#\[center\](.*?)\[/center\]#si";
   $replace[14] = '<div style=\'text-align:center\'>\1</div>';
   $search[15] = "#\[left\](.*?)\[/left\]#si";
   $replace[15] = '<div style=\'text-align:left\'>\1</div>';
   $search[16] = "#\[right\](.*?)\[/right\]#si";
   $replace[16] = '<div style=\'text-align:right\'>\1</div>';
   $search[17] = "#\[blockquote\](.*?)\[/blockquote\]#si";
   $replace[17] = '<div class=\'indent\'>\1</div>';
   $search[19] = "/\[color=(.*?)\](.*?)\[\/color\]/si";
   $replace[19] = '<span style=\'color:\1\'>\2</span>';
   $search[20] = "/\[size=([1-2]?[0-9])\](.*?)\[\/size\]/si";
   $replace[20] = '<span style=\'font-size:\1px\'>\2</span>';
   $search[21] = "#\[edited\](.*?)\[/edited\]#si";
   $replace[21] = '<span class=\'smallblacktext\'>[ \1 ]</span>';
   $search[22] = "#\[br\]#si";
   $replace[22] = '<br />';
   $search[23] = "#\[quote\](.*?)\[/quote\]#si";
   $replace[23] = '<br />Quote:<br /><div class=\'indent\'><i>"\1"</i></div>';
   $search[24] = '/([[:space:]])((((ht|f)tp(s?))\:\/\/)(www\.|[a-zA-Z0-9\-\.]+\.)+([a-zA-Z0-9\-\.]+\.)([a-zA-Z]{2,6})(\:[0-9]+)*(\/([[:space:]]|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-\/]+))*)([[:space:]]|<br|$)/si';
   $replace[24] = '\1<a href="\2" target=_blank>\2</a>\13';
   $search[25] = '/([[:space:]])(www\.|[a-zA-Z0-9\-\.]+\.)+([a-zA-Z0-9\-\.]+\.)([a-zA-Z]{2,6})(\:[0-9]+)*(\/([[:space:]]|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-\/]+))*([[:space:]]|<br|$)/si';
   $replace[25] = '\1<a href="http://\2\3\4\5\6" target=_blank>\2\3\4\6</a>\8';
   $search[26] = '/((([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})/si';
   $replace[26] = '<a href="mailto:\1">\1</a>';
   $search[27] = "#\[list\](.*?)\[/list\]#si";
   $replace[27] = '<ul>\1</ul>';
   $search[28] = "#\[\*\]#si";
   $replace[28] = '<li>';
   $search[29] = "/\[table\](.*?)\[\/table\]/si";
   $replace[29] = '<table width="100%" border="0">\1</table>';
   $search[30] = "/\[td\](.*?)\[\/td\]/si";
   $replace[30] = '<td><span class="articleText">\1</span></td>';
   $search[31] = "/\[tr\](.*?)\[\/tr\]/si";
   $replace[31] = '<tr>\1</tr>';

   $text = preg_replace($search, $replace, $text);
   return $text;
}


Then instead of all those eregi calls you make just do:
Code:
$message = bbcode_to_html($message);


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group