BBCode in PHP

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Thu Sep 04, 2008 2:51 pm    Post subject: BBCode in PHP Reply with quote

Hello,

I currently have BBCode support on my forums, however the BBCode engine I wrote uses str_ireplace for most of the handling.

for example:

(url=http://www.www.com)Title(/url)

Translates:

Code:

(url=
to
<a href='


Code:

)
to
'>


and

Code:

(/url)
to
</a>


It works okay and all, but the normal (url)TITLE(/url) tag won't work, using a close square bracket gets translated to '>

For example:

I will type something [inside of brackets]

translates to:

I will type something [inside of brackets'>


______________


So, what I'm looking for is a little help on how it would be coded the proper way, like Abyss's URL rewrite code.

How can I make it so

[url=[A-z0-9]+][A-z0-9]+[/url]

will translate to a normal uri?

Thanks tons in advance,
Toasty
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Sun Sep 14, 2008 9:52 am    Post subject: Reply with quote

It's been 10 days, and I still am at a loss.

Perhaps I will drink Gatorade and piss on my server until it trains itself...
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
NuccatheWarrior
-


Joined: 18 Oct 2007
Posts: 82

PostPosted: Wed Sep 17, 2008 5:14 pm    Post subject: Reply with quote

Use an image within in the url bbcode for phpbb. Its better off with an image than words. For the url bbcode it just gives it self a title as it is linked in the forums
_________________
Site Administrator of Nucca The Warrior's Website

http://nuccathewarrior.kicks-ass.org
Back to top View user's profile Send private message Visit poster's website
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Wed Sep 17, 2008 6:12 pm    Post subject: Reply with quote

phpBB is the reason I wrote my own forum system, because I think phpBB is more of a waste of time, and displays a strong lack of concern about a site, than writing your own. Plus, the support sucks epicly.

I suppose I'll be on my own, thought there were more PHP programmers here...
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Fri Sep 19, 2008 5:02 am    Post subject: Reply with quote

There are lots of PHP programmers here. The problem is most of them come here for help or for information, not to help others. Str_replace() doesn't really work well for this type of bbcode, and I don't know regular expressions.
_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Sep 20, 2008 1:34 am    Post subject: Reply with quote

Hello Toasty,

Here's a few links that will help you handle BBcode parsing:
http://www.phpit.net/article/create-bbcode-php/
http://elouai.com/bbcode-sample.php
Back to top View user's profile Send private message Visit poster's website
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Fri Oct 17, 2008 2:19 pm    Post subject: Reply with quote

Sorry for the late response.

Thank you for the links, looks like I can use the first one the most, the second link looks similar to what I'm using already.

-Toasty
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
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


Powered by phpBB phpBB Group