Token Templates will generate HTML - often based on the data a editor entered, and/or which was provided from the App.
The View determines which template file is being loaded.
Token templates are by far not as powerful as Razor Templates. We always recommend Razor.
<h1>[Header:Title]</h1> <ul> <repeat> <li><a href="[Content:Link]">[Content:Title]</a> [Content:Toolbar]</li> </repeat> </ul>
How it Works
Token templates use a Token Engine to generate Html. The convention uses placeholders like
[Scope:Property] to put data into the Html.
The template files usually reside inside app root folder or sub folder. These end with
Placeholders and code usually is marked with
Internally the Token-Engine uses LookUps to find what can be shown.
Tokens are very limited, we strongly recommend to use Razor Templates templates instead.
Read more about it in the Token Basics
Content, Presentation and Toolbar Tokens
[Content:Toolbar]to get a Toolbar for the Content-object with it's Presentation
Token Toolbars only support the basic toolbar, not the newer TagToolbar. Read more about Toolbars.
Note that in Token-templates the
Header is called the
ListContent for historical reasons, not
Header like in Razor.
[ListContent:Toolbar]for the toolbar
Common LookUp Sources
- App Sources
- Web Server and System Sources Hybrid
These work both on Dnn and Oqtane (2sxc 12+)
- Web Server and System Sources
- CMS / Dnn Sources
- User Information Sources
Read more about LookUp Sources
Repeaters / Lists
Token templates have a trivial mechanism to loop through lists. Note that we strongly recommend you use Razor Templates instead. Here's how it works:
<ol> <repeat repeat="Item in Data:Default"> <li> [Item:Title] [Item:Toolbar] <br> <a href="?details=[Item:UrlKey]">Details...</a> </li> </repeat> </ol>
In a repeater the Toolbar can be added using
- Introduced in 2sxc 1.0