Introduction

What is BBCode?

BBCode is a special implementation of HTML. Whether you can actually use BBCode in your posts on the forum is determined by the administrator. In addition you can disable BBCode on a per post basis via the posting form. BBCode itself is similar in style to HTML, tags are enclosed in square brackets [ and ] rather than < and > and it offers greater control over what and how something is displayed. Depending on the template you are using you may find adding BBCode to your posts is made much easier through a clickable interface above the message area on the posting form. Even with this you may find the following guide useful.

To alter the colour or size of your text the following tags can be used. Keep in mind that how the output appears will depend on the viewers browser and system:

Changing the colour of text is achieved by wrapping it in [color=][/color]. You can specify either a recognised colour name (eg. red, blue, yellow, etc.) or the hexadecimal triplet alternative, e.g. #FFFFFF, #000000. For example, to create red text you could use:

[color=red]Hello![/color]

or

[color=#FF0000]Hello![/color]

Both will output Hello!

Changing the text size is achieved in a similar way using [size=][/size]. This tag is dependent on the template the user has selected but the recommended format is a numerical value representing the text size in percent, starting at 20 (very small) through to 200 (very large) by default. For example:

Quoting and outputting fixed-width text

Quoting text in replies

There are two ways you can quote text, with a reference or without.

When you utilise the Quote function to reply to a post on the board you should notice that the post text is added to the message window enclosed in a [quote=""][/quote] block. This method allows you to quote with a reference to a person or whatever else you choose to put! For example to quote a piece of text Mr. Blobby wrote you would enter:

[quote="Mr. Blobby"]The text Mr. Blobby wrote would go here[/quote]

The resulting output will automatically add "Mr. Blobby wrote:" before the actual text. Remember you must include the quotation marks "" around the name you are quoting, they are not optional.

The second method allows you to blindly quote something. To utilise this enclose the text in [quote][/quote] tags. When you view the message it will simply show the text within a quotation block.

If you want to output a piece of code or in fact anything that requires a fixed width, e.g. Courier type font you should enclose the text in [code][/code] tags, e.g.

[code]echo "This is some code";[/code]

All formatting used within [code][/code] tags is retained when you later view it. PHP syntax highlighting can be enabled using [code=php][/code] and is recommended when posting PHP code samples as it improves readability.

Generating lists

Creating an Unordered list

BBCode supports two types of lists, unordered and ordered. They are essentially the same as their HTML equivalents. An unordered list outputs each item in your list sequentially one after the other indenting each with a bullet character. To create an unordered list you use [list][/list] and define each item within the list using [*]. For example to list your favourite colours you could use:

The second type of list, an ordered list, gives you control over what is output before each item. To create an ordered list you use [list=1][/list] to create a numbered list or alternatively [list=a][/list] for an alphabetical list. As with the unordered list, items are specified using [*]. For example:

[list=1][*]Go to the shops[*]Buy a new computer[*]Swear at computer when it crashes[/list]

will generate the following:

Go to the shops

Buy a new computer

Swear at computer when it crashes

Whereas for an alphabetical list you would use:

[list=a][*]The first possible answer[*]The second possible answer[*]The third possible answer[/list]

Additionally, phpBB features something called Magic Links, this will turn any syntactically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to www.phpbb.com being output when you view the message.

The same thing applies equally to email addresses, you can either specify an address explicitly for example:

[email]no.one@domain.adr[/email]

which will output no.one@domain.adr or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.

As with all the BBCode tags you can wrap URLs around any of the other tags such as [img][/img] (see next entry), [b][/b], etc. As with the formatting tags it is up to you to ensure the correct open and close order is following, for example:

Showing images in posts

Adding an image to a post

phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and secondly the image you display must already be available on the internet (it cannot exist only on your computer for example, unless you run a webserver!). To display an image you must surround the URL pointing to the image with [img][/img] tags. For example:

[img]http://www.phpbb.com/theme/images/logos/blue/160x52.png[/img]

As noted in the URL section above you can wrap an image in a [url][/url] tag if you wish, e.g.

Attachments can now be placed in any part of a post by using the new [attachment=][/attachment] BBCode, if the attachments functionality has been enabled by a board administrator and if you are given the appropriate permissions to create attachments. Within the posting screen is a drop-down box (respectively a button) for placing attachments inline.