How To‎ > ‎

Use Tokens in DNN Skins

Starting with version 1.5, it's possible to call My Tokens from DNN Skins by use of My Tokens Skin Object. Same principle applies for integrating My Tokens in any ascx or aspx file, including 3rd party modules.

To include My Tokens in DNN skins follow instructions below.

  1. Open the (skin).ascx file that you want to display tokens.
  2. Include following line at beginning of file:

    <%@ Register TagPrefix="avt" TagName="MyTokens"
     Src="~/DesktopModules/avt.MyTokens/SkinObjectReplacer.ascx" %>

  3. Put this line where you want the token to appear (token is just an example, replace with any token available)

    <avt:MyTokens runat = "server" Token = "[User:UserName]" />
The syntax above has the limitation that it only allows static content inside the Token parameter. What if you need to pass a parameter like the current user ID? Starting with version 2.4.52 it's possible to pass the content that needs tokenized like this:

    <avt:MyTokens runat = "server">
        <Content>[My:Token(WithParam="<%= MyId %>")]</Content>

Furthermore, the Skin Object can be replaced with a direct invocation of the My Tokens API. Here is a C# example (so language needs to be "C#" in the control definition).

<%= avt.MyTokens.MyTokensController.Tokenize("[My:Token(WithParam='"+ MyId +"')]",
              UserController.GetCurrentUserInfo(), null, false) %>