Communifire's Page Builder template syntax is based on Handlebars.Net. Using the functions on this page, you can create your own Page Builder templates and customize how your community's content appears in widgets. With conditionals, iterators, and variables that retrieve content and user data, the templates you can create are endless.
Example
<div class="axero-widget axero-widget-entity-icon-list {{CustomCSSClass}} {{#if HideContainerBorder}}axero-widget-no-border{{/if}}"> <div class="axero-widget-header"> <h3>{{WidgetTitle}}</h3> </div> <div class="axero-widget-content"> <ul> {{#each Contents}} <li> <div class="entity-icon"> <i {{#if IsFeatured}}style="color:blue"{{/if}} class="{{EntityIconCssClass}}"></i> </div> <div class="entity-title"> <a title="{{{Title}}}" href="{{ContentURL}}">{{{Title}}}</a> <br/> <div class="small nobold"> {{EntityTypeText}} {{../Resources.GlobalByText}}: <a href="{{AuthorUserProfileURL}}">{{{AuthorUserDisplayName}}}</a> </div> </div> </li> {{/each}} </ul> </div> </div>
General syntax
Cases
Discussions
Events
Files
Users
Videos
Wall Posts
When creating a people widget template, use the Insert widget specific token menu to get any user profile field data. The template for profile fields is {{{field:Field name}}}. To check if a certain profile field has a value, use the format {{#if ||field:Field name||}} Content {{else}} Alternate content {{/if}} .
{{#if ||field:Field name||}} Content {{else}} Alternate content {{/if}}
People Directory widgets require "User." before the variable (e.g. {{{User.UserInfoDisplayName}}} ). Single person widgets require "Contents." before the variable. (e.g. {{{Contents.UserInfoDisplayName}}} )
{{{User.UserInfoDisplayName}}}
{{{Contents.UserInfoDisplayName}}}
Iterator Functions
These functions iterate through content.
If Functions
These functions check content type.
{{#if (compare Variable "ComparisonValue")}} {{/if}}
Note: Integer comparison values do not need surrounding quotes.
"==" is the default operation in the compare helper. To use a different operator, add the operator in quotes between the variable and comparison value:
{{#if (compare Variable ">" ComparisonValue)}} {{/if}}
List of operators:
Examples:
{{#if (compare EntityType "Event")}}<div class="when">{{{EventWhen}}}</div>{{/if}}
{{#if (compare CommentCount ">" 0)}}<div class="comments">{{CommentCount}} comments</div>{{/if}}
{{date DateTimeVariable "operation" "option"}}
DateTimeVariable should be a DateTime field (e.g. EventStartDate) instead of a datetime string, which requires converting to DateTime, which may not be as reliable.
Example:
{{date EventStartDate "dayofweek" "short"}}
{{#if (even Variable)}} {{/if}}
Checks if a number is even.
{{#if (even @index)}}class="even-child"{{/if}}
{{#if (and (Case) (Case))}}
The logic helper can be followed by as many cases as you want to evaluate.
List of logic helpers:
{{#if (or (compare EntityType "Article") (compare EntityType "Blog"))}}
{{math Variable "+" Variable}}
You can also specify a number of places to round to:
{{math Variable "/" Variable 2}}
{{math ContentID "+" CommentCount}}
{{{toLowerCase Variable}}}
The to lowercase helper converts text in a variable to lowercase.
{{{toLowerCase Title}}}
{{{replaceSpaceWithHyphen Variable}}}
The replace spaces with hyphen helper replaces all spaces in a variable with hyphens.
{{{replaceSpaceWithHyphen Title}}}
Please enable JavaScript to use file uploader.
is requesting access to a wiki that you have locked: https://my.axerosolutions.com/spaces/5/communifire-documentation/wiki/view/23109/page-builder-template-language-syntax