What is Token Replacement module?
02 Nov 2021 418 0

Token replacement module is a content template used to replace a list of available tokens from entities such as page, portal, user, browser, etc. To use this module. Firstly you need to setup a template before we can add this content template to any other page.

If you go to the Dashboard admin. There is a module called "Token Replacement" module. 

When you are in the Token Replacement Admin screen.

You need to click the New Template button to create a new template.

There are 9 entities of tokens available for you to use. Here is the list of the entity information.

1. Page Entity

Page Entity represents the DNN page tab information. 

Token format: [PAGE:TABNAME]

  • TABID
    This represents the page Tab Id.
     
  • TABORDER
    This represents the tab order or sort index.
     
  • PORTALID
    This represents the site Portal ID. 
     
  • TABNAME
    This represents the Page tab name.
     
  • PARENTID
    This represents the Page parent ID
     
  • TITLE
    This represents the Page SEO Title
     
  • DESCRIPTION
    This represents the Page SEO Description
     
  • KEYWORDS
    This represents the Page SEO Keywords
     
  • ISSECURE
    This represents if the page is secured page.
     
  • LEVEL
    This represents the page level. For example. A page can have parent page or children pages.
     
  • TABPATH
    This represents the URL path of the page.
     
  • TABURL
    This represents the full URL of the page.
     

2. Portal Entity

Portal entity represents the site portal information.  

Token format: [PORTAL:PORTALID]

  • PORTALID
    This represents the site portal id. 
     
  • HOMEDIRECTORY
    This represents the site portal home directory.
     
  • GUID
    This represents the site Portal GUID information.
     
  • CURRENCY
    This represents the Site currency information.

3. User Entity

User entity represents the user profile information.

Token format: [USER:FIRSTNAME]

  • USERNAME
    This represents the username of a user. The username is used for login to the site.
     
  • FIRSTNAME
    This represents a user profile first name.
     
  • LASTNAME
    This represents a user profile last name.
     
  • ISSUPERUSER
    This represents a flag true or false if a user is a super user.
     
  • EMAIL
    This represents a user profile email address.
     
  • ISSUPERUSER
    This represents a user profile display name.

4. Browser Entity

Browser entity represents the browser of your site visitor use.

Token format: [BROWSER:ID]

  • ID
    This represents a browser type such as Chrome, IE, etc.
     
  • VERSION
    This represents a browser version.
     
  • TYPE
    This represents a browser type engine such as Chrome94.
     
  • PLATFORM
    This represents a browser platform environment such as WinNT.
     
  • MAJORVERSION
    This represents the browser major version.
     
  • MINORVERSION
    This represents the browser minor version.

5. QueryString Entity

QueryString entity represents the query string key of your browser URL address.  For example: https://dnninfo.com/download?page=1. The page is the query string key that has a value of 1. The token will be [QUERYSTRING:PAGE].

Token format: [QUERYSTRING:KEY]

6. Cookie Entity

Cookie entity represents the name of the Request.Cookies collection in .Net framework. For Example if you have a cookie name called Title. The token will be [QUERYSTRING:TITLE].

Token format: [COOKIE:KEY]

7. Session Entity

Session entity represents the session state in .Net framework. For Example if you have a session called called Login. The token will be [QUERYSTRING:LOGIN].

Token format: [COOKIE:LOGIN]

8. URLADDRESS Entity

URLAddress entity represents the URL address information used for your site.

Token format: [URLADDRESS:FULLADDRESS]

  • FULLADDRESS
    This represents the full address of the current page of your site.
     
  • DOMAINNAME
    This returns the domain name.
     
  • ABSOLUTEURI
    This returns the absolute url of the current page. Example: /default.aspx
     
  • ABSOLUTEPATH
    This returns the absolute path of a page.
     
  • RAWURL
    This returns the full URL address.
     
  • SECURECONNECTION
    This return True or False if the current page is secure page.

8. RANDOM Entity

Random entity is used to generate a random string or number or GUID value. The max keyword in the random number type represents the highest number you want to random. For example: if you put 1000, it will random between 0 to 1000. While the LENGTH keyword for the String and Letter represent the length of the random text.(NUMBER=MIN,MAX), (LETTER=LENGTH), (STRING=LENGTH), GUID

Example: [RANDOM:(NUMBER=1,10)], [RANDOM:GUID], [RANDOM:(STRING=15)], [RANDOM:(LETTER=8)]

Once you have created the token template you can now install the template token to any page you want. To install it. Simply click the add Module option and install a module name called "DNNInfoTRP Token Replacement".

Once install into a page. You need to set the module setting to choose which template you want to use. Go to the module settings.

In the module settings screen under the DNNInfoTRP Token Replacement Settings Tab. Choose the template you just created.

Click the Update button and the template token will display on the page. Here is the sample of tokens we use.