vBulletin 5 Connect Template Syntax 
vBulletin 5 Connect expands on the vBulletin Markup used in templates. These are the new methods you can use for manipulating and retrieving content from the API and Database.

New Built-in Methods

{vb:set}
{vb:set} is used for assigning template variables during the execution of a template.
Parameter PositionParameter NameTypeRequiredDescription
1variablestringYesThe name of the variable being assigned
2valuecompilable codeYesThe value being assigned
Code:
{vb:set name, 'Adrian'}
The value of $name is {vb:raw name}.
The above example will output:
The value of $name is Adrian. 
{vb:template}
{vb:template} is used for including other templates in the current template.
Parameter PositionParameter NameTypeRequiredDescription
1templatestringYesThe name of the template to include
2...∞[var=value]compilable codeNoVariable to pass local to template
Template:
This is {vb:raw arg1}. Today is {vb:raw arg2}
Code:
{vb:template template, arg1="an example", arg2="Sunday"}
The above example will output:
This is an example. Today is Sunday
{vb:js}
{vb:js} is used for including javascript files from filesystem easily before body close tag.
Parameter PositionParameter NameTypeRequiredDescription
1...∞path[, ...]relative pathYesRelative path of the javascript file to include
Code:
{vb:js js/test.js, js/test1.js}
The above example will output the following code before </body>:
<script type="text/javascript" src="https://localhost/vb5/js/test.js?v=500a36"></script>
<script type="text/javascript" src="https://localhost/vb5/js/test1.js?v=500a36"></script>
{vb:cssextra}
{vb:cssextra} is used for including css templates easily before head close tag (all css templates are included in one request).

Parameter PositionParameter NameTypeRequiredDescription
1...∞template[, ...]stringYesThe name of the css template
Code:
{vb:cssextra test.css, test1.css}
The above example will output the following code before </head>:
<link rel="stylesheet" type="text/css" href="https://localhost/vb5/core/css.php?styleid=x&amp;td=xxx&amp;sheet=xxx.css,...,test.css,test1.csss?ts=xxxxxxxxxxx" />

{vb:hook}
{vb:hook} is used for including templates hooks in current template.

Parameter PositionParameter NameTypeRequiredDescription
1hookstringYesThe name of the template hook
Code:
{vb:hook test}
{vb:redirect}
{vb:redirect} is used for perfoming a php redirect during the execution of a template.

Parameter PositionParameter NameTypeRequiredDescription
1urlurlYesThe url of the page to redirect
Code:
{vb:redirect 'https://www.google.com.ar/'}
{vb:strcat}
{vb:strcat} is used for concatenating values to the given variable.

Parameter PositionParameter NameTypeRequiredDescription
1variablestringYesThe name of the variable being assigned
2...∞string[, ...]compiable codeNoThe value being concatenated
Code:
{vb:strcat test, 'This is a', ' test'}
{vb:raw test}
The above example will output the following:
This is a test
{vb:strrepeat}
{vb:strrepeat} is used for repeating a string to the given variable.

Parameter PositionParameter NameTypeRequiredDescription
1inputvariableYesThe string variable to be repeated
2multipliervariableYesThe positive integer variable of time the input should be repeated
Code:
{vb:set input, '. '}
{vb:set multipler, 10}
{vb:strrepeat input {vb:raw multipler}}
{vb:raw input}
The above example will output the following:
. . . . . . . . . . 
{vb:data}
{vb:data} is used for setting an API class and method return value to the given variable.

Parameter PositionParameter NameTypeRequiredDescription
1variablestringYesThe name of the variable being assigned
2controllerstringYesThe name of the called controller
3methodstringYesThe name of the called method
4...∞argumentcompilable codeNoVariable to pass to called method
Code:
{vb:data unread, content_privatemessage, getUnreadInboxCount}
{vb:raw unread}
vB_Api_Content_Privatemessage->getUnreadInboxCount()

The above example will output the count of undeleted notifications.

{vb:url}
{vb:url} is used for building an hyperlink url of the specified route.

Parameter PositionParameter NameTypeRequiredDescription
1routestringYesThe route identifier (routeid or name)
2dataarrayNoData for building route
3extraarrayNoAdditional data to be added
4optionsarrayNoOptions for building URL
noBaseUrl: skips adding the baseurl
Code:
{vb:url 'lostpw'}
The above example will output the following:
https://localhost/vb5/lostpw
{vb:debugvardump}
{vb:debugvardump} is used for dumping information about a variable.

Parameter PositionParameter NameTypeRequiredDescription
1expressionvariableYesThe variable you want to dump
Code:
{vb:debugvardump $user}
The above example will output the dump of user variable into a nice red box.

{vb:php}
{vb:php} is used to run allowed php functions during the execution of a template.

Parameter PositionParameter NameTypeRequiredDescription
1function namestringYesThe name of the function
2...∞string[, ...]compiable codeNoArguments of the function
Code:
{vb:set test, {vb:php implode, ',', {vb:raw variable}}}
PHP Equivalent:
<?php

$test 
implode(','$variable);
Allowed functions:
Copyright © 2024 MH Sub I, LLC dba vBulletin. All rights reserved. vBulletin® is a registered trademark of MH Sub I, LLC dba vBulletin.