|
| 1 | +--- |
| 2 | +uid: text |
| 3 | +locale: en |
| 4 | +title: TEXT Theme object |
| 5 | +dnnversion: 09.02.00 |
| 6 | +previous-topic: ddrmenu |
| 7 | +next-topic: theme-objects |
| 8 | +related-topics: theme-objects,themes,create-theme |
| 9 | +links: |
| 10 | +--- |
| 11 | + |
| 12 | +# TEXT Theme Object Introduction |
| 13 | + |
| 14 | +Displays Localized text in your theme / skin, also supports the use of DNN Core Token replacement. |
| 15 | + |
| 16 | +The text will be loaded from a resource file (*.resx), you need a separate resx file per language. |
| 17 | + |
| 18 | +These should be located in a folder named "App_LocalResources" (in the Theme folder). |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +## Naming convention: |
| 23 | + |
| 24 | +When your skin file = index.ascx: |
| 25 | +Default language: index.ascx.resx |
| 26 | +French: index.ascx.fr-FR.resx |
| 27 | +German: index.ascx.de-DE.resx |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +## Resource file content: |
| 32 | + |
| 33 | +~~~ |
| 34 | +<?xml version="1.0" encoding="utf-8"?> |
| 35 | +<root> |
| 36 | +<data name="Welcome.Text"> |
| 37 | + <value>Welcome</value> |
| 38 | + </data> |
| 39 | +</root> |
| 40 | +~~~ |
| 41 | + |
| 42 | + |
| 43 | +**Current Version:** 01.00.00 |
| 44 | + |
| 45 | + |
| 46 | +## Include in Theme |
| 47 | + |
| 48 | +### ASCX |
| 49 | +``` html |
| 50 | +<%@ Register TagPrefix="dnn" TagName="TEXT" Src="~/Admin/Skins/Text.ascx" %> |
| 51 | + <dnn:TEXT runat="server" id="dnnTEXT-Welcome" ShowText="Welcome, " ResourceKey="Welcome.Text" ReplaceTokens="False" /> |
| 52 | +``` |
| 53 | + |
| 54 | +### HTML Token |
| 55 | +[TEXT] |
| 56 | + |
| 57 | +### HTML Object Token |
| 58 | +``` html |
| 59 | +<object id="dnnTEXT" codetype="dotnetnuke/server" codebase="TEXT"></object> |
| 60 | +``` |
| 61 | + |
| 62 | +| Attribute | Description | Default | Posssible Values | DNN Version | |
| 63 | +| --- | --- | --- | --- | --- | |
| 64 | +| ShowText | The text to display if there is no text<br/>available from a resource file. | | | 01.00.00 | |
| 65 | +| CssClass | This value is the name of a CSS class that will be added to the rendered HTML.<br/>(the text will be rendered inside a span) | Normal | | 01.00.00 | |
| 66 | +| ResourceKey | The name of XML element's content in the resource file (*.resx) to be used. | | Hello.Text | 01.00.00 | |
| 67 | +| ReplaceTokens | This true/false value will tell DNN to look for system tokens and replace them with the appropriate text | False | True<br/>False | 01.00.00 | |
| 68 | + |
| 69 | +## Tokens |
| 70 | +> [!NOTE] |
| 71 | +> |
| 72 | +
|
| 73 | +Below is only a small selection of the tokens that can be useful, but you can use all of the supported Core Tokens |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +| Name | Value | Description | |
| 79 | +| --- | --- | --- | |
| 80 | +| User Display name | [User:displayname] | The display name of the current user | |
| 81 | +| User First Name | [User:firstname] | The first name of the current user | |
| 82 | +| User Lastname | [User:lastname] | The last name of the current user | |
| 83 | +| Portal Name | [Portal:portalname] | The name of the current Portal | |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +## Examples: |
| 89 | + |
| 90 | +### Text Theme Object Fallback text |
| 91 | +Show Fallback text as the Resourcekey is not found |
| 92 | + |
| 93 | +~~~html |
| 94 | +<dnn:TEXT runat="server" id="dnnTEXT-fallback" ShowText="Fallback" CssClass="dnn-text" ResourceKey="Main.Text" ReplaceTokens="False" /> |
| 95 | + |
| 96 | + |
| 97 | +~~~ |
| 98 | + |
| 99 | + |
| 100 | +### Text Theme Object EN, FR, NL text |
| 101 | +Example for English, French and Dutch |
| 102 | + |
| 103 | +~~~html |
| 104 | +<dnn:TEXT runat="server" id="dnnTEXT-Demo" ShowText="Demo" CssClass="dnn-text" ResourceKey="Example.Text" ReplaceTokens="False" /> |
| 105 | +~~~ |
| 106 | + |
| 107 | + |
| 108 | +### Text Skin Object Tokens |
| 109 | +Use Tokens for a personalized message |
| 110 | + |
| 111 | +~~~html |
| 112 | +<dnn:TEXT runat="server" id="dnnTEXT-Tokens" ShowText="Tokens" CssClass="dnn-text" ResourceKey="Token.Text" ReplaceTokens="True" /> |
| 113 | +~~~ |
| 114 | + |
0 commit comments