If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP to parse custom BBCodes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-06, 08:45
YeahWhat YeahWhat is offline
Registered User
 
Join Date: May 2005
Posts: 39
ASP to parse custom BBCodes

This is a free script I've decided to share, its a bbCode parser.

I wrote this in response to seeing the sourcecode for phpBB, and basically being absolutely appalled by how poorly written the software was. In particular, the bbCode engine is more than 800 lines of PHP code, and for being such a huge script, its almost impossible to change the code to something more userfriendly. You can't change any of the codes, you can't make codes accept new arguments, and it takes a lot of skill and patience to successfully create a new code.

So, I felt like writing my BBCode engine, and even though its only 44 lines long (it comes to 215 lines with all of the comments and documentation I've put into the code below), this engine is basically all-purpose:

- You can define new codes instantly.
- Codes can accept 0 to an infinite number of arguments. (Note: an argument is something that comes after the "=" in a bbCode. The {B}{/B} tag accepts 0 arguments, and the {url=somelink}{/url} tag accepts 1 argument. Several arguments in a single code are seperated by semicolons, such as {url=somelink; tooltip_text; target_window}{/url}.)
- And you can control whether codes have an endtag or not.

This script works really well for blog posts and comments, guestbooks, message boards, or anywhere that users might want to format their text.

Because vBulletin applies bbCode formatting to the sourcecode, I've included the code as an attachment, however you can see a working sample of the script here.

w00t! Free code
Attached Files
File Type: zip ycode.zip (3.6 KB, 57 views)

Last edited by YeahWhat; 03-30-06 at 08:51.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On