BBCode is a core part of your forum system. We understand that. To that end, we've been working hard to completely rewrite and overhaul the entire bbcode handler in IP.Board 3.0. We think you'll like what is in store.
Changes since IP.Board 2.x
There are some core differences in the BBCode system we are introducing in IP.Board 3 that you may notice right away. For starters - *every* BBCode is configurable via the Admin CP. That means if you want to add "rel='nofollow'" to your urls, you can do so without editing files. If you want to change the resulting HTML for a code tag, you can do so, right there in the admin CP. Similarly, the backend treats every bbcode as "custom" as a result, and every bbcode is treated equally.
Additionally, we are changing the HTML that the bbcode parsing generates to be more XHTML compliant. Alt attributes are added to image tags. We've changed emoticons to place the emoticon code in the alt attribute, and have removed the (non-standard) emoid attribute entirely. Quotes will properly use the blockquote HTML tag (and, further, will use the "cite" HTML tag when you provide the name and link with the quoted text). Bold will now use the HTML "strong" tag and i will use the HTML "em" tag. Almost all of the bbcode HTML is being rewritten to be both more semantic, and to bring IP.Board's HTML output up to today's standards.
Additionally, the code-syntax boxes (e.g. HTML and SQL bbcode tags) are undergoing an overhaul that will make them much more flexible and allow us (and you!) to add new code languages very easily. We will be providing more information on how to do this in the future.
New features in the BBCode system
I'm sure this is what you've all been wanting to find out about. Well, here we go (in no particular order)...
- Aliases: BBcodes can now have aliases, so that more than one tag can execute the same custom bbcode. Uses? For instance, "code" and "codebox" both execute the same bbcode. Similarly, "media", "blogmedia", "flash", and "youtube" are all one bbcode that behaves the same way. (Hold your horses, we'll get to the media in a minute ;) )
- Single-tags now supported: You wanted to add "
". You now can.
- Option content is optional: Bet that sounded confusing. It really isn't - basically, taking the "URL" tag as an example, you can either provide the URL as the "option" to the URL tag, and display text as the "content", or you can omit the option entirely, and the content becomes the display text. This setting allows you to do the same thing with your own bbcode.
- Prevent other codes from parsing: You can prevent other bbcodes from parsing inside your own bbcode. The classic example is our "code" bbcode - you don't want smilies and other bbcodes parsing within the code bbcode when you're trying to show someone how to use them.
- PHP Plugin execution: Do you require a bit more logic to be carried out to replace the bbcode? You can utilize plugin files to do this. Plugin files have a defined interface and more information will be provided for developers near launch. Several of our default bbcodes utilize plugin files, so this should help developers more easily understand how they can be used. You will no longer need to modify built in bbcode processing files to add new bbcodes.
- Control which groups can use a bbcode: The bbcode manager now has a multiselect which allows you to specify which groups can utilize the bbcode (secondary groups also supported). So if you want admins to be able to create tables using a [table] bbcode tag, but not members, go for it.
- Control where each bbcode can be used: Want to allow images in posts, but not in signatures? Now you can configure this right from the bbcode management screens in the admin cp. This feature runs on a plugin system so modification developers can also allow you to configure which bbcodes are allowed in your custom applications.
New "default" BBCodes in IP.Board 3
I use the term "default" loosely, since everything is configurable via the ACP. In addition to all of the bbcodes you will find in IP.Board 2.x, the following default bbcodes will be available in IP.Board 3:
- "member". Usage: bfarber. This tag is a "single" tag bbcode that accepts one option, the member's display name. When parsing out the tag, the bbcode will generate the correct link to the member's profile and display "<a href='correct link'>member name</a>".
- "hr". Usage:
. Very simple bbcode which generates a horizontal rule.
- "xml" and "php". Usage:
$phpCode = 1;
. Generates syntax-highlighted code boxes, similar to the existing SQL and HTML boxes.
- "media". Usage: http://youtube.com/videolink. Ah, the one most of you have been waiting for. The introduction of the media tag in blog was so well received, we've gone ahead and added it to the IP.Board core. You can configure the media tag matches and replacements (for those of you who own Blog 1.4, you'll know what I mean), which allows you to add new media services at will. Generic flash (the old "" bbcode in IP.Board) works through this new media tag as well. Optionally accepts "width,height" as it's option.
Sharing and formatting content couldn't get much easier that configuring what you want in the ACP!
Dull boring techie stuff
For those of you actually interested in the code aspects of the new system, we've completely rewritten the bbcode parser from the ground up. Firstly, sections should go back to the proper way of calling pre_db_parse before storing content in the database, and pre_display_parse before actually displaying it. This will ensure that bbcode can be correctly unparsed when a user edits their content.
A major change to how the formatted text is handled: it isn't! We don't do any bbcode parsing on save, storing (nearly) exactly what you submitted into the database. Instead we format the bbcode at the time of displaying the content. This means we don't have to "unparse" previously parsed bbcode, nearly eliminating any bugs in attempting to do so.
Another nice thing about this method...while you will need to rebuild your posts when you upgrade to IP.Board 3, you should never need to again. Ever. Yes, you read that right - you will need to rebuild your posts once upon upgrading to IP.Board 3....but after that, no more rebuilding posts headaches. Additionally, we intend to fully update our command-line rebuild posts routine, and we intend to introduce a task which will do this for you automatically should you wish. More information on this will be available as we get closer to launch.
Some of you may be wondering about the resource impacts of parsing a post on every display. In rewriting the bbcode engine, we've nearly completely eliminated regular expressions in our bbcode engine. Regular expressions allow you to take a "pattern" and find matches to that pattern in a block of text. This is how bbcode was found and replaced in IP.Board 2.x (and in most other bbcode engines out there). For IP.Board 3, we are talking what's called a "tokenized" approach. We use some very fast built in php functions (such as strpos and substr_replace) instead of performing massive regular expressions, making the entire bbcode parsing process much quicker. We will be profiling this in greater detail as IP.Board 3 starts wrapping up. We'll try to share the results of this profiling with you at that time.
We've also entirely rewritten the word wrap function in IP.Board. It should now be fully HTML-safe, HTML-entity-safe, and multibyte-safe...three huge problems we've repeatedly run into with the word wrap function in IP.Board 2.x. Additionally, there will now be one word-wrap function, and it properly lives in the bbcode library (though for legacy purposes, we will maintain a "redirect" function in our text handler class similar to the function in ipsclass in IP.Board 2.x).
All in all, once we get the various inevitable kinks all ironed out with using the new system, it should not only be much easier to utilize our bbcode library, but it should be much more reliable and much faster to boot!
We hope you like the changes in store, and we hope that the updates which many of you have waited a long time for will serve your post-formatting needs for the forseeable future. Please share your thoughts or ask any questions you may have, and we'd be happy to try to answer them for you.