Difference between revisions of "BBCode"

From BakaBT Wiki
Jump to: navigation, search
(format & typos)
m (Modes)
Line 124: Line 124:
 
* Comment-style mode, new lines will appear as new lines, you can use all BBCode tags including the block constructors
 
* Comment-style mode, new lines will appear as new lines, you can use all BBCode tags including the block constructors
 
* HTML mode. New lines will not appear as new lines. The text will be treated as HTML code.
 
* HTML mode. New lines will not appear as new lines. The text will be treated as HTML code.
On default, comment-style mode is enabled. To enable HTML-mode you only have to include the <html> tag at the beginning of your description.
+
On default, comment-style mode is enabled. To enable HTML-mode you have to include <html> and </html> tags around your description.
  
 
==Comment-style mode==
 
==Comment-style mode==

Revision as of 05:07, 21 April 2009

This page will contain a list of all BBCode you can use on BoxTorrents, in the comments and in the torrent description. Keep in mind that our forum software (SMF) has it's own set of BBCode, namely the default set + spoiler tags, if you want more info on that check the SMF website.

General BBCode

All the BBCode tags in this section can be used in the comments as well as in the description

Basic MarkUp

[b] for bold text
[i] for italic (slanted) text
[u] for underlined text
[s] for striked through text
[sup] for superscript text
[sub] for subscript text
[center] for center aligned text
[color=red]text here[/color] for red text
[size=10pt]text here[/size] for bigger/smaller text

Links

First of all, all words that look like links will be replaced with a link. Words that look like links are words that begin with "http://".

[url]http://www.boxtorrents.com[/url] results in http://en.wikipedia.org/
[url=http://www.boxtorrents.com]BoxTorrents[/url] results in BoxTorrents

Images

[img]http://www.boxtorrents.com/images/search.gif[/img] will result in an image

Keep in mind that all images must be uploaded to a remote image host. BoxTorrents will not host your images for you. Also, do not link to images you didn't upload yourself. So do not link images from AniDB or any other site other than your remote image host. Good free image hosts are:

Code

[code]Code here[/code] will keep the formatting of the source text, it will not add colours.

Lists

[list]
 [li]first item[/li]
 [li]second item[/li]..
[/list]

Will make a list like:

  • first item
  • second item

You can nest lists

Tables

[table]
 [tr]
  [td]first cell[/td]
  [td]second cell[/td]
 [/tr]
 [tr]
  [td]third cell[/td]
  [td]last cell[/td]
 [/tr]
[/table]

Will produce a table like:

first cell second cell
third cell last cell

Quotes

[quote]quoted text[/quote] to make a nameless quote
[quote=name]quoted text[/quote] to make a quote by 'name'
[quote author=name]quoted text[/quote] to make a quote by 'name'
[quote author=name link=link date=date]quoted text[/quote] for SMF-style quotes

Pressing the [Quote] button of a comment will automatically load that comment into your add-a-comment page. You can nest quotes.

NoParse

[noparse]don't parse this text[/noparse]

will not apply BBCode parsing to the text, it will still replace http:// links

Description only tags

Block constructions

All websites are built by stacking 'blocks' (starting at the top left corner). Too make it easier for you to make descriptions I've added block constructions so that you can more easily align text and images without needing tables.

[left=300]text goes here[/left]

makes a block 300 pixels wide and it will 'float' to the left. If you add another left-floating block it will appear next to it. If there is no more space on the page to put the block beisde other left-floating blocks it will 'wrap' to the next line.

[right=300]text goes here[/left]

makes a block that will 'float' to the right. Similar to the [left] tag.

[clear]

will end the current line forcing all floating blocks to start on a new line.

[center]

will make a block that floats in the center. You can not have two (or more) blocks floating in the center on one line. Use the clear-tag to start a new line.

Screenshots

Adding these tags will not do anything to your description, instead it will add screenshots just below your description using a lightbox for easy viewing.

[screenshot]screenshot code goes here[/screenshot]
[screenshot=200]screenshot code goes here[/screenshot]

The optional parameter affects the width (in pixels) of the screenshot thumbnails. If you don't supply it, it will default to 150 pxiels. You can add more than one block of screenshots, possibly with different size thumbnails.

[img]link to image[/img]

Will add one image. You can add as many as you like.

[url=link to image][img]link to thumbanil[/img][/url]

Allows you to explicitly define your own thumbnail. If no thumbnail is supplied it will use the linked image and resize it to whatever width is supplied for the thumbnail. Having a lot of big images on your screen can slow down your browser, so if possible supply a thumbnail! Thumbnails are automatically added for:

  • imageshack
  • photobucket
  • tinypic
  • xs

Example code

[screenshot]
 [img]link to image1[/img]
 [img]link to image2[/img]
[/screenshot]

Use this code if you're using an imagehost for which the site will automatically detect the thumbnail image.

[screenshot]
 [url=image link1][img]thumbnail link1[/img][/url]
 [url=image link2][img]thumbnail link2[/img][/url]
[/screenshot]

Use this code if you can supply your own thumbnail.

Anything beside img/url-tags in the screenshot tags will not be shown.

More about torrent Descriptions

Modes

There are two modes:

  • Comment-style mode, new lines will appear as new lines, you can use all BBCode tags including the block constructors
  • HTML mode. New lines will not appear as new lines. The text will be treated as HTML code.

On default, comment-style mode is enabled. To enable HTML-mode you have to include <html> and </html> tags around your description.

Comment-style mode

For all uses of BBCode in comment-style mode see the BBCode section above.

HTML Mode

In HTML mode you can do anything you want, stylesheets, JavaScript, anything. We trust users will not abuse this feature as we realize it is a potential security hazard. Abuse of HTML mode will not be tolerated. We apply a one-strike-no-warning-kiss-your-ass-goodbye policy.

Technical stuff

As you may have realized all descriptions get some 'added' stuff, both comment-style and HTML-style modes. The parser will add a few things to your description that you will get for free :)

  • First of all it will add a proper HTML-header if it's not present, and a head, and a body.
  • It will add a very basic stylesheet containing some default text-formatting settings. You are free to override this stylesheet as it will be inserted before your stylesheet.
  • Finally it will add the jQuery Javascript-library and postifx a script to resize the description. I can implore anyone who uses Javascript on a regular basis to look at jQuery because it really makes your life easy.

Recalculating the size of the iframe

If you have a description that may change it's height as users view it (expanding lists for instance) you can call the

bxt_resize_iframe()

function to recalculate the size of the iframe. Make sure you call it after the new size of the description is set else it will not resize propperly.

Javascript:window.onload

I can only implore you so much to not use an onload event as there is little reason to use it. The added JavaScript-code uses the window.onload event to resize the iframe to it calculated height after all images have been loaded (this is why it needs window.onload), images may affect the height of a description.

If you do supply a window.onload event make sure you put it in your head so the resize-script can call your onload event after it's done resizing.

If you put the window.onload event in the body it will most likely overwrite the call to the resize function and you may end with a description frame that is too small or too big.

Common mistakes

  • Often people forget to include the HTML-tag for HTML description. A typical symptom is a large amount of empty lines at places you didn't expect it.
  • Using code like:
<a href="http://www.boxtorrents.com">BoxTorrents</a>

Will not make your link totally red. The catch is that the text will become red, but the underline will not. To set the colour of a link propperly either apply the style to the link itself or supply the correct colour in a stylesheet.