V. Standard BBCode Library

[ Previous: B. Text Styles | Next: D. Replaced Items ]

C. Links

[url]address[/url]

[url=address]title[/url]

[url target=target]address[/url]

[url=address target=target]title[/url]
The [url] tag, which is available in two different forms, allows you to insert links to external documents. In the first form, it simply marks the URL as a link:

        [url]http://www.google.com[/url]   -->   http://www.google.com

In the second form, you can specify the text to appear within the link:

        [url=http://www.google.com]Google![/url]   -->   Google!

Note that for safety's sake, the [url] tag will only accept local (relative) URLs, and URLs that use the http:, https:, ftp:, or mailto: protocols. In particular, it will not accept any URL that uses the javascript: protocol; this limitation is for security reasons, and can prevent code injection on your site. NBBC also performs static checks on the given URL to ensure that it is legal: For example, it knows that http://foo is not a legal URL and will not allow it.

The target= parameter mirrors that of the HTML <a> element, and allows the link to open in a different window or frame. It accepts all of the standard window names that the <a> element's target= parameter accepts, including "_blank", "_self", "_parent", and "_top", as well as specifically-named windows and frames.

(Note: for security reasons, the target= parameter is disabled by default, and must be manually enabled using the BBCode::SetURLTargetable() function for this parameter to be usable in your BBCode. See BBCode::SetURLTargetable() for more details.)

[email]address[/email]

[email=address]title[/email]
The [email] tag lets you easily insert someone's e-mail address. Like the [url] tag, it is available in two forms. In the first form, it simply marks the e-mail address as a link:

        [email]billg@microsoft.com[/email]   -->   billg@microsoft.com

In the second form, you can specify the text to appear within the link:

        [email=billg@microsoft.com]Bill G.[/email]   -->   Bill G.

For safety's sake, NBBC performs static checks on the given e-mail address to ensure that it is legal: For example, it knows that john@foo is not a legal e-mail address and will not allow it.

[wiki="name"]

[wiki="name" title="title"]
The [wiki] tag is used internally by NBBC when it encounters a [[wiki]] tag (see the section on wiki tags for more details): The [[wiki]] tag is converted into a [wiki] tag, which is then converted into a URL based on the address of the installed wiki. Like the [url] tag, it is available in two forms. In the first form, it simply marks the wiki name as a link:

        [[The White House]]   -->   The White House
        [wiki="The White House"]   -->   The White House

In the second form, you can specify the text to appear within the link:

        [[The White House|1600 Pennsylvania Avenue]]   -->   1600 Pennsylvania Avenue
        [wiki="The White House" title="1600 Pennsylvania Avenue"]   -->   1600 Pennsylvania Avenue

Both of these are considerably shorter and easier to use than the [url]-based version, which is why wiki-links exist:

        [[The White House]]   -->   The White House

        [url=http://en.wikipedia.org/wiki/The_White_House]The White House[/url]
                  -->   The White House

The [wiki] tag does not have an end tag.

[ Previous: B. Text Styles | Next: D. Replaced Items ]


Copyright © 2010, the Phantom Inker. All rights reserved.