PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Dec 09, 2019 12:53 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Simple BBTag Parser
PostPosted: Wed Sep 10, 2008 8:07 pm 
Offline
Forum Newbie

Joined: Wed Sep 10, 2008 8:03 pm
Posts: 1


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Sat Feb 13, 2010 11:30 pm 
Offline
Tranquility In Moderation
User avatar

Joined: Sun Feb 06, 2005 8:18 pm
Posts: 5001
Location: Indiana

_________________
- A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Mon Feb 15, 2010 4:00 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
I don't think Corbyn checks in much these days. From looking at his code, I don't think malformed tags like "[ i ]" will work.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Tue Feb 16, 2010 1:52 pm 
Offline
Tranquility In Moderation
User avatar

Joined: Sun Feb 06, 2005 8:18 pm
Posts: 5001
Location: Indiana
I did that so the board wouldn't parse it

but i wrote my own parser that will just match the start tag through to the end tag and replace

_________________
- A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Wed Feb 17, 2010 11:31 pm 
Offline
DevNet Master

Joined: Wed Feb 11, 2004 4:23 pm
Posts: 4872
Location: Palm beach, Florida
Surely there is lots that could be re-factored, but since when has BBcode had to change? If it aint broke don't fix it! (if it has to be changed often then by all means refactor the hell out of it)
-- directed at @arborint (even tho your response are excellent advice for learning about refactoring & good practices)

Based on that note I'd change the find & replace arrays to be only ONE array, and use key() and current() to read them out. That way you don't have to jump like 20 lines of code to match them up

array(
'find1',
'find2'
)

array(
'replace1'
'replace'2
)

change to

array(
'find1' => 'replace1',
'find2' => 'replace2'
)

Image


Top
 Profile  
 
 Post subject: Re: Simple BBTag Parser
PostPosted: Sun Aug 01, 2010 12:20 pm 
Offline
Forum Newbie

Joined: Sat Jul 31, 2010 7:15 am
Posts: 10
While designing a good layout for a webpage, sometimes we need to convert bbcode tag to html and vice versa. Thanks for such simple and yet simple bb tag parser to convert common bb tags to html, and vice versa. Wish you best of luck as a professional coder.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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

Jump to:  
Powered by phpBB® Forum Software © phpBB Group