Link Syntax 
Creating Links in Templates

When you wish to use a url in a template the format is as follows:

{vb:link string, array[, array][, string, string]}
{vb:link [thread|member|forum|blog], {vb:raw threadinfo}[, {vb:raw pageinfo}][, 'id', 'title']}


The first argument is a string that notifies the system which type of URL is to be output. The valid types are thread, forum, and member

The second argument is an array that contains the id and title, as the minimum requirements, of the link to be generated. For thread, this would be threadid and title. For forum this would be forumid and title. For member this would be userid and username.

The third argument is an optional array that contains any arguments that are required to be sent along, such as perpage (pp), page (pagenumber), order, and so on.

The simplest forms are:

{vb:link thread, {vb:raw threadinfo}}
{vb:link forum, {vb:raw foruminfo}}
{vb:link member, {vb:raw userinfo}}

If you have an array containing the id and title but they do not follow the conventional naming conventions, then you may specify their names with the fifth and sixth options. Both must be specified for them to be recognized. For example, you have $post[threadid] and $post[threadtitle] and wish to output a thread url. You would use:

{vb:link thread, {vb:raw post}, null, 'threadid', 'threadtitle'}

null was specified for the $pageinfo argument array since this example had no arguments.

If you wish to output a url that uses & instead of & e.g.: to be used within javascript, append "|js" to your type argument so that thread becomes thread|js, member becomes member|js. If you wish to not output a sessionhash, in any instance, say for a url to be used within an email, append nosession to the type argument, so that thread becomes thread|nosession

Examples:

To output a link to a post, you could use

<a href="{link thread, {vb:raw threadinfo}, {vb:raw pageinfo_lastpost}}#post$lastpostinfo[lastpostid]">$threadinfo[title]</a>

$pageinfo_lastpost would appear like:

$pageinfo_lastpost = array('p' => 1234);

Creating Links in PHP

When creating a link in the code, use the fetch_seo_url function, which accepts the same arguments.

function fetch_seo_url(string, array, array, string, string)

In fact the {vb:link thread, {vb:raw threadinfo}, {vb:raw pageinfo}} syntax is just replaced with fetch_seo_url() when a template is compiled.

Examples:

Infractions tab of a user's profile
$linkinfo = array('postuserid' => 123, 'postusername' => 'freddie');
$pageinfo = array('tab' => 'infractions);
$memberurl = fetch_seo_url('member', $linkinfo, $pageinfo, 'postuserid', 'postusername');

Using the mod rewrite output, $memberurl would be /members/123-freddie?tab=infractions

Please refer to the code for exact examples.
User Contributed Notes: Link Syntax Add a Comment