Search
Tuesday, March 19, 2024
User manualsEasyDNNnews

EasyDNNnews User's manual

Custom fields tokens in HTML templates

Previous Article Search fields and advanced article search
Next Article Localization of custom fields

Custom fields tokens in HTML templates

Custom fields are displayed in articles with tokens in the HTML templates. There is a shared token [EDNcf:ShowAll] that displays a whole custom field group on the position of the token. Besides a joint token that displays a whole custom field group, it is possible to use individual tokens for each field.

You can find individual tokens for each custom field in EasyDNNnews > Dashboard > Edit Custom Fields. Next to each custom field, its token is listed.

An example:

[EDNcf:price] – displays the value of the custom field price
[EDNcf:price:showlabel:default] – displays the label and value of the custom field price
[EDNcf:price:showlabel:onlylabel] – displays only the label of the custom field price

Conditional tokens:

[EDNcf:IfExists:TokenName] [EDNcf:EndIf:TokenName] 
- if the custom field value exists then the content between these two tokens is displayed

[EDNcf:IfNotExists:TokenName] [EDNcf:EndIf:TokenName]
- if the custom field value does not exist then the content between these two tokes is displayed

 

Custom fields expression tokens

The custom fields expression tokens check values in custom field values in templates.

[EDNcf:Expression:CustomFieldTokenID:operator:value]
[EDNcf:EndExpression:CustomFieldTokenID]

operator: =, !=, >, >=, <, <=
value: value to compare

value types:
text: "some text"
number: 123
empty value: ""

 

Examples:

Field type:
Multicontrol > DropDownList

Multicontrol > RadioButtonList
Multicontrol > CheckBoxList

[EDNcf:Expression:Country:=:"Germany"]
                Welcome to Germany
[EDNcf:EndExpression:Country]

[EDNcf:Expression:Country:!=:"Germany"]
                Germany is not selected
[EDNcf:EndExpression:Country]

[EDNcf:Expression:HorsePower:<:80]
                Not so fast car
[EDNcf:EndExpression:HorsePower]

[EDNcf:Expression:HorsePower:>:200]
                Very fast car
[EDNcf:EndExpression:HorsePower]

 

Field type:
Textbox > Integer
Textbox > Decimal
Textbox > Money

[EDNcf:Expression:Price:>:1550.49]
                Very expensive product
[EDNcf:EndExpression:Price]

[EDNcf:Expression:Price:<:25.99]
                Very cheap product
[EDNcf:EndExpression:Price]
 

Field type:
Textbox > Text

[EDNcf:Expression:Product-Name:=:"NewPhone"]
                This is new Mobile Phone product
[EDNcf:EndExpression:Product-Name]

[EDNcf:Expression:Product-Name:!=:"NewPhone"]
                This is not new Mobile Phone product
[EDNcf:EndExpression:Product-Name]
 

Field type:
Textbox > Date/Time

format = "MM/dd/yyyy HH:mm:ss"
"MM"   The month, from 01 through 12.
"dd"      The day of the month, from 01 through 31.
"yyyy"  The year as a four-digit number.
"HH"      The hour, using a 24-hour clock from 00 to 23.
"mm"    The minute, from 00 through 59.
"ss"        The second, from 00 through 59.

[EDNcf:Expression:RegistrationDate:<:03/07/2017 14:15:29]
                Registration date is before 03/07/2017
[EDNcf:EndExpression:RegistrationDate]

[EDNcf:Expression:RegistrationDate:>:03/07/2017 14:15:29]
                Registration date is after 03/07/2017
[EDNcf:EndExpression:RegistrationDate]
 

Field type:
Checkbox

[EDNcf:Expression:Pool:=:true]
                House have pool
[EDNcf:EndExpression:Pool]

[EDNcf:Expression:Pool:=:false]
                House does not have pool
[EDNcf:EndExpression:Pool]

 

Previous Article Search fields and advanced article search
Next Article Localization of custom fields
Print
Last update: 09.03.2018 / Rate this article:
3.0

Table Of Contents

Categories

Copyright 2024 by EasyDNNsolutions Terms Of Use Privacy Statement