Fork me on GitHub
DNN Apps - Demo-Zone
Discover DNN-Apps - simple and elegant, easy to customize
You are here: Home  >  Apps  >  Tutorial - Tokens

Token Tutorial

This is an App showing all the things you can do with tokens. 

Download the app here

Simple demo of Tokens showing a Content-Item

The following demo shows the most common use case - a template for a single content-items which the editor added to the module himself

Subject: I have a question

Message: this is great ff

Category: Complaint (4621)

Simple demo of Tokens showing a Content-Items with Presentation

The presentation-information (in the edit dialog at the bottom, usually half-hidden) gives the editor the ability to change the visual appearence of the content-item. There are a few reasons to keep it separate from the main content-item, but the most important one is that if we re-use the content-item (like an address shown as text in one place and as a Google-Map elsewhere) then the presentation-settings are completely different in both cases. So the presentation is specific to one content-item in one output.

So you'll notice that the Content:PresentationColor-token is in the Style.

Subject: I have a question

Message: this is great ff

Category: Complaint (4621)

Simple demo of Tokens using list of Content-Items

The following demo shows the most common list-case - a list of content-items which the editor added to the module himself

  1. I have a question: this is great ff - Category: Complaint (4621)

Two Lists in Tokens

This shows how to use multiple repeats in a token template. This template has a query attached which will deliver a stream of Feedback and a stream of Category.

Categories

  1. Question - this is #1 of a 2 - is it First /
  2. Complaint - this is #2 of a 2 - is it / Last

Feedback

  1. edited top - this is #1 of a 22 - (First)
  2. I have a question - this is #2 of a 22 - ()
  3. 1824 - this is #3 of a 22 - ()
  4. 1828 - this is #4 of a 22 - ()
  5. 1829 - this is #5 of a 22 - ()
  6. - this is #6 of a 22 - ()
  7. 2152 - this is #7 of a 22 - ()
  8. e - this is #8 of a 22 - ()
  9. 2155 - this is #9 of a 22 - ()
  10. 2209 - this is #10 of a 22 - ()
  11. 1555 - this is #11 of a 22 - ()
  12. 1614 - this is #12 of a 22 - ()
  13. 1631 - this is #13 of a 22 - ()
  14. 2015-02-17 - this is #14 of a 22 - ()
  15. 2015-02-17 2225 - this is #15 of a 22 - ()
  16. 2015-04-05 - this is #16 of a 22 - ()
  17. 2015-04-05 932 - this is #17 of a 22 - ()
  18. 0953 - this is #18 of a 22 - ()
  19. 1519 - this is #19 of a 22 - ()
  20. 1531 - this is #20 of a 22 - ()
  21. add new - this is #21 of a 22 - ()
  22. addnew directly - this is #22 of a 22 - (Last)

Introduction to the Tokens Tutorial

This tutorial should show you all kinds of things you can do with tokens.

No demo item exists for the selected template.

    Standard DNN/DotNetNuke Tokens

    The following tokens are common DNN/DotNetNuke tokens which should work everywhere tokens are in use. Some very common extensions are in the other view Extended Tokens.


    Token Description Result

    Portal

    [Portal:Currency] Currency String USD
    [Portal:Description] Portal Description
    [Portal:Email] Portal Admin Email daniel.mettler@2sic.com
    [Portal:FooterText] Portal Copyright Text Copyright 2017 by DotNetNuke Corporation
    [Portal:HomeDirectory] Portal Path (relative) of Home Directory /App-Demos/
    [Portal:LogoFile] Portal Path to Logo File
    [Portal:PortalName] Portal Name DNN / DotNetNuke App Demos
    [Portal:PortalAlias] Portal URL
    [Portal:TimeZoneOffset] Difference in Minutes between Portal Default Time and UTC
       

    User

    [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

    [Membership:Approved] Is User Approved?
    [Membership:CreatedOnDate] User Signup Date
    [Membership:IsOnline] Is User Currently Online?
       

    User Profile

    [Profile:<property>] Use any default or custom Profile Property as listed
    in Profile Property Definition section of Manage User Accounts.
    Use non-localized Property Name only.
    -
       

    Tab (Page)

    [Tab:Description] Page Description Text for Search Engine
    [Tab:EndDate] Page Display Until Date *******
    [Tab:FullUrl] Page Full URL https://2sxc.org/dnn-app-demos/en/Apps/Tutorial-Tokens
    [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 Tutorial - Tokens
    [Tab:TabPath] Page Relative Path //Apps//Tutorial-Tokens
    [Tab:Title] Page Title (Window Title)
    [Tab:URL] Page URL
       

    Module

    [Module:Description] Module Definition Description 2sxc App is an extension that allows to install and use a 2sxc app.
    [Module:EndDate] Module Display Until Date *******
    [Module:Footer] Module Footer Text
    [Module:FriendlyName] Module Definition Name App
    [Module:Header] Module Header Text
    [Module:HelpURL] Module Help URL
    [Module:IconFile] Module Path to Icon File
    [Module:ModuleTitle] Module Title App
    [Module:PaneName] Module Name of Pane (where the module resides) ContentPane
    [Module:StartDate] Module Display from Date *******
       

    DateTime / Ticks

    [DateTime:Now] Current Date and Time 11/18/2017 7:15 PM
    [Ticks:Now] CPU Tick Count for Current Second 636466617194700606
    [Ticks:Today] CPU Tick Count since Midnight 636466464000000000
    [Ticks:TicksPerDay] CPU Ticks per Day (for calculations) 864000000000
       

    Note that according to the DNN-Source-Code there are a total of 11 sources (status 2015-05-05). They are:

    1. Date (missing above)
    2. DateTime
    3. Ticks
    4. Culture (missing)
    5. Portal
    6. Tab
    7. Host (missing)
    8. Module
    9. User
    10. Membership
    11. Profile

    Extended Standard Tokens

    The following tokens are still very "normal" but not part of the common DNN tokens. They work in 2sxc - but not in many DNN-Tools

    Token Description Result

    QueryString

    [QueryString:<Url-Param-Name>] String -
    [QueryString:TabId] String - this demo shows the TabId
    which is in the QueryString because of the internal URL-Rewrite.
    730
    [QueryString:Category] String - click here to see effect
       

    Form

    [Form:<Form-Param-Name>] Form post values. Usually not needed, but if you do need it, it's here. -
       

    Server

    [Server:<Server-Property>] Many Server-Properties -
    [Server:PATH_INFO] Example of a property /Default.aspx

    All Server Keys

    Variable Description
    [Server:ALL_HTTP] Returns all HTTP headers sent by the client. Always prefixed with HTTP_ and capitalized
    [Server:ALL_RAW] Returns all headers in raw form
    [Server:APPL_MD_PATH] Returns the meta base path for the application for the ISAPI DLL
    [Server:APPL_PHYSICAL_PATH] Returns the physical path corresponding to the meta base path
    [Server:AUTH_PASSWORD] Returns the value entered in the client's authentication dialog
    [Server:AUTH_TYPE] The authentication method that the server uses to validate users
    [Server:AUTH_USER] Returns the raw authenticated user name
    [Server:CERT_COOKIE] Returns the unique ID for client certificate as a string
    [Server:CERT_FLAGS] bit0 is set to 1 if the client certificate is present and bit1 is set to 1 if the cCertification authority of the client certificate is not valid
    [Server:CERT_ISSUER] Returns the issuer field of the client certificate
    [Server:CERT_KEYSIZE] Returns the number of bits in Secure Sockets Layer connection key size
    [Server:CERT_SECRETKEYSIZE] Returns the number of bits in server certificate private key
    [Server:CERT_SERIALNUMBER] Returns the serial number field of the client certificate
    [Server:CERT_SERVER_ISSUER] Returns the issuer field of the server certificate
    [Server:CERT_SERVER_SUBJECT] Returns the subject field of the server certificate
    [Server:CERT_SUBJECT] Returns the subject field of the client certificate
    [Server:CONTENT_LENGTH] Returns the length of the content as sent by the client
    [Server:CONTENT_TYPE] Returns the data type of the content
    [Server:GATEWAY_INTERFACE] Returns the revision of the CGI specification used by the server
    [Server:HTTP_<HeaderName>] Returns the value stored in the header HeaderName
    [Server:HTTP_ACCEPT] Returns the value of the Accept header
    [Server:HTTP_ACCEPT_LANGUAGE] Returns a string describing the language to use for displaying content
    [Server:HTTP_COOKIE] Returns the cookie string included with the request
    [Server:HTTP_REFERER] Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
    [Server:HTTP_USER_AGENT] Returns a string describing the browser that sent the request
    [Server:HTTPS] Returns ON if the request came in through secure channel or OFF if the request came in through a non-secure channel
    [Server:HTTPS_KEYSIZE] Returns the number of bits in Secure Sockets Layer connection key size
    [Server:HTTPS_SECRETKEYSIZE] Returns the number of bits in server certificate private key
    [Server:HTTPS_SERVER_ISSUER] Returns the issuer field of the server certificate
    [Server:HTTPS_SERVER_SUBJECT] Returns the subject field of the server certificate
    [Server:INSTANCE_ID] The ID for the IIS instance in text format
    [Server:INSTANCE_META_PATH] The meta base path for the instance of IIS that responds to the request
    [Server:LOCAL_ADDR] Returns the server address on which the request came in
    [Server:LOGON_USER] Returns the Windows account that the user is logged into
    [Server:PATH_INFO] Returns extra path information as given by the client
    [Server:PATH_TRANSLATED] A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping
    [Server:QUERY_STRING] Returns the query information stored in the string following the question mark (?) in the HTTP request
    [Server:REMOTE_ADDR] Returns the IP address of the remote host making the request
    [Server:REMOTE_HOST] Returns the name of the host making the request
    [Server:REMOTE_USER] Returns an unmapped user-name string sent in by the user
    [Server:REQUEST_METHOD] Returns the method used to make the request
    [Server:SCRIPT_NAME] Returns a virtual path to the script being executed
    [Server:SERVER_NAME] Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs
    [Server:SERVER_PORT] Returns the port number to which the request was sent
    [Server:SERVER_PORT_SECURE] Returns a string that contains 0 or 1. If the request is being handled on the secure port, it will be 1. Otherwise, it will be 0
    [Server:SERVER_PROTOCOL] Returns the name and revision of the request information protocol
    [Server:SERVER_SOFTWARE] Returns the name and version of the server software that answers the request and runs the gateway
    [Server:URL] Returns the base portion of the URL

    App Tokens

    The following tokens are related to App-Information and Resources. DNN/DotNetNuke does have these, you can only access them when in a 2sxc-App.

    Token Description Result

    App

    [App:Path] /App-Demos/2sxc/Tutorial Tokens
    [App:PhysicalPath] \\nasw1\P\2sxc\Web\App-Demos\2sxc\Tutorial Tokens
       

    App Settings

    [App:Settings:<Property>] App Settings which the App-designer defined. -
    [App:Settings:UseLightbox] All the information (multi-lingual) true
       

    App Resources

    [App:Resources:<Property>] All the information (multi-lingual) -
    [App:Resources:GreetingText] All the information (multi-lingual) Hello there Token-Learner
       
    2serve . 2invent . 2create is 2be.