BBCode for [code]? (Features)

by bttr ⌂ @, Berlin, Germany, Friday, March 23, 2007, 08:52 (4641 days ago) @ Alex

That's interesting but it replaces indentations by something like "&nbsp; &nbsp; ". Actually <pre> is here more appropriate (one of the advantages of the BBCode class is better HTML output). How about two types of bbcodes: [ code] and [codeblock]? Maybe a little bit confusing?

see source code comments:
1) Replace 2 spaces with "&nbsp; " so non-tabbed code indents without making huge long lines.
2) Replace tabs with "&nbsp; &nbsp;" so tabbed code indents sorta right without making huge long lines.

This was taken directly from phpBB and could be omitted, if you don't want it.

I just downloaded phpBB to see how they've solved that. Ideed they don't use <pre> (not even <code> ) but nevertheless inline code isn't possible:

Did you read my PHP source code? ;-) It has a line: code lifted from phpBB 2.0.20's file 'includes/bbcode.php' at

Complete thread:

 RSS Feed of thread

powered by my little forum