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 # of a - is it /
          2. Complaint - this is # of a - is it /

          Feedback

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

          Introduction to the Tokens Tutorial

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

          Error Showing Content - please login as admin for details.

          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 2024 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 according to user 4/24/2024 3:29 PM
          [DateTime:System] Current Date and Time of the server 4/25/2024 12:29 AM
          [DateTime:UTC] Current Date and Time in UTC 4/24/2024 10:29 PM
          [Ticks:Now] CPU Tick Count for Current Second 638496017561578770
          [Ticks:Today] CPU Tick Count since Midnight 638496000000000000
          [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.
          [QueryString:Category] String - click here to see effect Design
             

          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

          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] \\nasw2\P\2sxc 2019b\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.