An overlooked new feature of the DNN 4.6+ releases is the ability to add tokens to the text/html module. This has been a long awaited feature that will finally allow you to add personalization to your content.
Thanks to Mitchell Sellers for bringing this enhancement to my attention.
Minimum Version and Enabling
First of all this function is ONLY supported with Text/HTML version 4.06.00, this comes packaged with DotNetNuke version 4.6.0. If you are upgrading to 4.6.0 you will want to be sure that this upgrade is installed. (It might not be installed if you used the upgrade package). By default the support for tokens is disabled so you will need to enable it on a per instance basis. You can access the token processing settings via the "Settings" option from the module's action menu, below is a screencapture of the settings available.

As Mitchell points out, the available options you are given three distinct options for token replacement support. The default option of "no replace" will result in a module that functions just like all previous versions of the module. The use of ANY other setting will result in module caching and inline editing being disabled. This is done because since tokens are used it cannot rely on the caching to display appropriate information.
Using Tokens
Using these tokens is quite easy. Anyone that has had experience using XMod constants or using the Ventrian products should be quite used to working with tokens. As an example, if you want to show the portal name, you would use Portal:PortalName]. If you want to personalize a home page greeting, you coud use [User:Username|Welcome {0}!] . Optional formating can be added by using the | (pipe bar character) after the initaial token.
The information after the word welcome is a placeholder that informs the module where the token should be placed in the sentence structure. The {0} tells the token engine to put the value for that token in for that value.
Below is a list of the current available tokens that you can use on your DNN site:
| Token |
Description |
| [Portal:Currency] |
Currency String |
| [Portal:Description] |
Portal Description |
| [Portal:Email] |
Portal Admin Email |
| [Portal:FooterText] |
Portal Copyright Text |
| [Portal:HomeDirectory] |
Portal (relative) Path of Home Directory |
| [Portal:LogoFile] |
Portal Path to Logo file |
| [Portal:PortalName] |
Portal Name |
| [Portal:PortalAlias] |
Portal URL |
| [Portal:TimeZoneOffset] |
Difference in minutes between Portal default time and UTC |
| |
|
| [User:DisplayName] |
User’s Display Name |
| [User:Email] |
User’s Email Address |
| [User:FirstName] |
User’s First Name |
| [User:FullName] |
[deprecated] |
| [User:LastName] |
User’s Last Name |
| [User:Username] |
User’s Login User Name |
| |
|
| [Membership:Approved] |
Is User Approved? |
| [Membership:CreatedDate] |
User Signup Date |
| [Membership:IsOnline] |
Is User Currently Online? |
| |
|
| [Profile:<Property>] |
Use any default or custom Property defined for user profiles as listed in Profile Property Definition section of Manage User Accounts. Please use non-localized Property titles only. |
| |
|
| [Tab:Description] |
Page Description Text for Search Engine |
| [Tab:EndDate] |
Page Display Until Date |
| [Tab:FullUrl] |
Page Full URL |
| [Tab:IconFile] |
Page Relative Path to Icon file |
| [Tab:KeyWords] |
Page Keywords for Search Engine |
| [Tab:PageHeadText] |
Page Header Text |
| [Tab:StartDate] |
Page Display from Date |
| [Tab:TabName] |
Page Name |
| [Tab:TabPath] |
Page Relative Path |
| [Tab:Title] |
Page Title (Window Title) |
| [Tab:URL] |
Page URL |
| |
|
| [Module:Description] |
Module Definition Description |
| [Module:EndDate] |
Module Display Until Date |
| [Module:Footer] |
Module Footer Text |
| [Module:FriendlyName] |
Module Definition Name |
| [Module:Header] |
Module Header Text |
| [Module:HelpUrl] |
Module Help URL |
| [Module:IconFile] |
Module Path to Icon File |
| [Module:ModuleTitle] |
Module Title |
| [Module:PaneName] |
Module Name of Pane where UDT resides |
| [Module:StartDate] |
Module Display from Date |
| |
|
| [DateTime:Now] |
Current Date and Time |
| [Ticks:Now] |
CPU Tick Count for Current Second |
| [Ticks:Today] |
CPU Tick Count since Midnight |
| [Ticks:TicksPerDay] |
CPU Ticks per Day (for calculations) |
For date/time and numeric values, you can also append a <format> string defined by the .Net framework, for example: [DateTime:Now|<format>] current date/time formatted according to <format>, e. g. [DateTime:Now|f] displays current date in short format (does not apply to expressions of calculated columns)
Buck Anderson's DotNetNuke Training, Video Training, and Internet Marketing Resource Center DNNprofessor.com. Free tips to
improve your business with DotNetNuke, XMod, website design techniques, and proven
unconventional Internet Marketing Solutions that attract the attention of today's
savvy Internet buyer at DNNprofessor.com. © 2008 Jive Media Group LLC and Buck Anderson.
All Rights Reserved. Reproduction without permission prohibited.
|