Results 1 to 1 of 1
  1. #1
    Join Date
    May 2005

    Unanswered: 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 Attached Files
    Last edited by YeahWhat; 03-30-06 at 09:51.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts