====== How do I develop email templates for promio.connect? ======
The following document provides technical information for the development of email templates for promio.connect.
===== General information =====
* Special characters must use XML-conform entities:
* ''"''
* ''&''
* '''''
* ''<''
* ''>''
* for all other entities, you have to use decimal syntax; e.g., use '' '' instead of '' ''
* UTF-8 4-byte characters are not supported at the moment. You can check the byte length with several tools, e.g., [[http://www.ltg.ed.ac.uk/~richard/utf-8.cgi|UTF-8 Tool]].
* The length of lines in the source code **must not exceed 700 characters**.
If you use an IDE to develop the template, use the following namespaces for correct syntax highlighting:
===== OTML =====
OTML is an extension of the HTML standard, specifically created for usage in promio.connect's email editor.
Because of this, an understanding of HTML and CSS is mandatory.
OTML serves the cause to make designated parts of an email editable. The global structure of the email will not be affected.
At first, the email developer creates the email as usual. After this is done, all intended parts can be made editable with the usage of OTML.
The OTML elements are separated into two namespaces: ''pm'' and ''pme'':
* ''pm'' elements are used for the automatic generation or integration of content, such as the table of contents or data sources.
* ''pme'' elements are user-editable elements, e.g., single-line and multi-line editors.
==== Editable Title ====
If you want the user to be able to edit the title of the mail, add the attribute ''editable="true"'' to your ''
'' tag. This has mostly only an effect if the email is opened in its stand-alone browser version.
=== Example ===
E-Mail Title
...
==== Repeater ====
A repeater is represented by the OTML tag ''''.
A repeater element defines an area of repeating blocks and **must contain one or more '''' elements**. Each layout can then be
added to the email by the user via a selection list.
The repeater element can hold one or more '''' elements.
^ Attribute ^ Type ^ Required ^ Description ^
| title | string | No | Title of the repeater. This is useful if you use more than one repeater in your template. |
=== Example ===
==== Layout ====
A layout is represented by the OTML tag ''''.
A layout element contains a template, which can be added to the email. It's a sub-element of the '''' element and can be
added multiple times.
^ Attribute ^ Type ^ Required ^ Description ^
| name | string | Yes | Unique name for the layout |
=== Example ===
==== Repeater content ====
A repeater content is represented by the OTML tag ''''.
The repeater content determines a pre-defined part of a '''' element and acts exactly like a '''' element.
It's a sub-element of the '''' element and can be added multiple times. With the '''' element it's possible
to pre-fill a ''''.
=== Example ===
==== Preheader ====
A preheader is represented by the OTML tag ''''.
A preheader is the preview text which is shown beneath the sender in most email clients.
During the build process of the email, the content of the preheader element will be put directly after the '''' tag. All
tracking pixels provided by promio.connect will be embedded after the preheader. This way, there is no HTML source code visible to the
end-user.
This is the preheader text.
==== Singleline ====
A singleline element is represented by the OTML tag ''''.
The singleline element offers a simple text input field and is mostly used for short texts like a headline.
^ Attribute ^ Type ^ Required ^ Description ^
| data-pmclass | string | No | The value will be set as class on the link element, if a link is added to the singleline element. |
| label | string | No | The title of the element, which is shown in the edit view. |
| linkable | boolean | No | If linkable is false, its not possible to add or change a link around the singleline element. |
| pmtoctitle | string | No | Title for entry inside the TOC.
Set a value to preallocate a title or leave it blank to make it possible, to set a TOC title if desired. |
| max-length | integer | No | Maximum lenght of characters. The user will not be able to exceed this limit. |
=== Example ===
My Headline
Click me
==== Multiline and Multiline-Config ====
A multiline element is represented by the OTML tag ''''.
The multiline element offers an advanced text and HTML editor based on CKEditor 4. It is mostly used for long texts or where HTML input is desired.
^ Attribute ^ Type ^ Required ^ Description ^
| label | string | No | The title of the element, which is shown in the edit view. |
| linkable | boolean | No | Make it possible to add a link around the editor content. If you enable this, we recommend that you use a special multiline-config for these editors in which the link button is removed from the toolbar. |
| pmtoctitle | string | No | Title for entry inside the TOC.
Set a value to pre-allocate a title or leave it blank to make it possible, to set a TOC title if desired. |
| max-length | integer | No | Maximum lenght of characters. The user is able exceed this limit, but a warning will be shown. |
| config | string | No | Name of the multiline-config, that should be used for this editor. |
=== Example ===
Lorem ipsum dolor sit amet
The multiline editor can be configured with a multiline-config element, which is represented by the OTML tag ''''.
^ Attribute ^ Type ^ Required ^ Description ^
| name | string | Yes | The name of the config element. |
| default | boolean | No | Set to true, if this config should be used for all pme:multiline elements, where no config is specified by name. |
The content of a multiline-config must be a CKEditor configuration in JSON format.
=== Example ===
{
"forcePasteAsPlainText": true,
"toolbar": [
{
"name": "basicstyles",
"items": [
"Bold",
"Italic",
"-",
"Subscript",
"Superscript",
"-",
"RemoveFormat"
]
},
{
"name": "links",
"items": [
"Link",
"Unlink"
]
},
{
"name": "insert",
"items": [
"Table",
"SpecialChar"
]
},
{
"name": "clipboard",
"groups": [
"clipboard",
"undo"
],
"items": [
"Cut",
"Copy",
"Paste",
"-",
"Undo",
"Redo"
]
},
{
"name": "promio",
"items": [
"promioPersFunc",
"promioTemplates"
]
},
{
"name": "document",
"items": [
"Source"
]
},
{
"name": "tools",
"items": [
"Maximize"
]
}
]
}
{
"forcePasteAsPlainText": true,
"toolbar": [
{
"name": "basicstyles",
"items": [
"Bold",
"Italic",
"-",
"Subscript",
"Superscript",
"-",
"RemoveFormat"
]
},
{
"name": "insert",
"items": [
"Table",
"SpecialChar"
]
},
{
"name": "clipboard",
"groups": [
"clipboard",
"undo"
],
"items": [
"Cut",
"Copy",
"Paste",
"-",
"Undo",
"Redo"
]
},
{
"name": "promio",
"items": [
"promioPersFunc",
"promioTemplates"
]
},
{
"name": "document",
"items": [
"Source"
]
},
{
"name": "tools",
"items": [
"Maximize"
]
}
]
}
/* This editor uses the default config */
Text
/* This editor uses the "linkable-editor" config */
Text
==== Image ====
Images have no special OTML element representation. Instead they use the standard HTML ''
'' tag with extended attributes.
^ Attribute ^ Type ^ Required ^ Description ^
| pmedit | boolean | No | If pmedit is true, the image is editable. |
| pmscale | string | No | Possible values: crop / height / width |
| pmscaleheight | integer | No | Use an alternate height instead of the one defined in the height attribute. This is useful for presentation on HiDPI / Retina displays. |
| pmscalewidth | integer | No | Use an alternate width instead of the one defined in the width attribute. This is useful for presentation on HiDPI / Retina displays. |
| pmtoctitle | string | No | Title for entry inside the TOC.
Set a value to preallocate a title or leave it blank to make it possible, to set a TOC title if desired. |
=== Values for pmscale ===
^ Value ^ Description ^
| crop | Center the image and crop it to the defined dimensions. **Height and width must be defined.**
| height | Resize the image to the defined height. The width is calculated proportional to the dimensions of the original image. |
| width | Resize the image to the defined width. The height is calculated proportional to the dimensions of the original image. |
=== Example ===
==== Appointment ====
To provide a link to an appointment, you can use the '''' element.
Based on the inserted data, an iCal calendar file will be generated.
^ Attribute ^ Description ^
| text | Text that is visible in the email |
| summary | Title of the appointment |
| organizerName | Name of the appointments organizer |
| organizerEmail | Email of the appointments organizer |
| dateTimeStart | Start date and time of the appointment |
| dateTimeEnd | End date and time of the appointment |
| location | Location of the appointment |
| description | Description of the appointment |
==== TOC ====
A TOC (table of contents) is represented by the OTML tag ''''.
The TOC element is used to automatically generate a table of contents based on the values and the order of used ''pmtoctitle'' attributes.
The TOC elements requires exactly one '''' element, which represents the the value of the processed ''pmtoctitle'' attribute. The
complete content of the TOC element is repeatedly inserted for each ''pmtoctitle'' attribute with a value.
=== Example ===
== Template ==
Content
Content
== Rendered code ==
==== External data sources ====
External data sources make it possible to embed content from RSS feeds into an email.
The setup of external data sources is individually realized by promio.net GmbH. If you are interested in the usage, please contact our support team via ticket.
=== Source ===
The source element is represented by the OTML tag ''''.
It serves as wrapper for the different source items and may contain one or more '''' elements.
^ Attribute ^ Required ^ Type ^ Description ^
| pmedit | No | boolean | If true, users are allowed to change datasources. |
=== Source item ===
A source item is represented by the OTML tag ''''.
It serves as the connection between the email and the setup data source.
^ Attribute ^ Required ^ Type ^ Description ^
| name | Yes | string | Unique name of the data source. |
| refreshmode | Yes | string | Possible values: build / delivery |
== Values for refreshmode ==
^ Value ^ Description ^
| build | Refresh data source on build of the email. |
| delivery | Refresh data source before sending the campaign. |
=== Data section ===
A data section is represented by the OTML tag ''''.
Data sections are used to fill the template with content from the data source with the help of data items. **Each data section must contain
at least one '''' element.**
^ Attribute ^ Required ^ Type ^ Description ^
| source | Yes | string | The name of the datasource. |
| items | No | json | A json object. Use one entry per data item inside the current data section, to define, how the next data item will be chosen.
If no option is chosen, it defaults to "next". | |
With the ''items'' attribute, it is possible to define the selection of content for each data item.
^ Value ^ Description ^
| (itemId) | Choose a data item on the base of its unique id. |
| next | Choose the next data item in the list. This is the most used option. |
| rand | Choose a random data item. |
== Example ==
If you want to set the content of the first data item to the unique id ''12345'' and random data for the second one, use this string:
{ 1: 12345, 2: "rand" }
=== Data item ===
A data item is represented by the OTML tag ''''.
Data items are placed inside a data section. Each one represents one record from the data source.
Inside a data item, it's possible to use the placeholder ''[pm:item:field_name]'' to get access to a field of the data source record. With the
''cut'' function, it is also possible, to shorten the content of a placeholder to a specified amount of characters.
E.g.: ''[cut([pm:item:title], 20)]'' shortens the title to a maximum of 20 characters.
It's only possible to access each data item one time. If you want to access the same item multiple times, it is necessary to use multiple
data sources with the same content. In this case, please contact our support team via ticket.
=== Example ===
== Sample data source "Top 10 Products" ==
^ id ^ title ^ price ^ image ^ link ^
|123 | Smartphone | 350.00 € | smartphone.jpg | www.sample.com/shop?productid=123 |
|124 | Watch | 150.00 € | watch.jpg | www.sample.com/shop?productid=124 |
|125 | Powerbank | 50.00 € | powerbank.jpg | www.sample.com/shop?productid=125 |
== Template code ==
== Rendered email code ==
=== If-conditions within data items ===
It is possible to use If-conditions within data items.
[pm:item:title]
|
[pm:item:priceReduced] == ""
Price: [pm:item:price]
Price: [pm:item:priceReduced]
instead of
|
==== External content ====
''pm:include-url-content'' is a very special tag. Use it to include the source code of a website into your email.
It is also possible to use this tag in the subject of an email.
^ Attribute ^ Type ^ Required ^ Description ^
| url | string | Yes | The URL of the content you want to include. |
| title | boolean | No | If true, the content of the URL's title tag is returned. |
=== Example ===
As content of an email:
This default text is only visible if the url does not return any content.
As subject:
This default title is only visible if the url does not return any content.
===== CSS =====
==== Automatic transformation from CSS to inline CSS ====
CSS from a <style> block can automatically be transformed to Inline CSS.
For more details on the matter refer to the **cssinline** and **cssinlinetype** options in [[en:otml#config_tags]]
==== User editable CSS ====
To give users the freedom to edit the CSS, there are some prerequisites:
* The style tag must use the id ''pn-js-css-editor''. Only one style tag with this id is allowed.
* Each selector must use a comment block with the descriptors ''@nav'', ''@navItem'' and ''@info''.
* ''@nav'' represents the category inside the CSS editor and groups the different ''@navItem'' elements.
* ''@navItem'' represents the element inside the category. This name must be unique for all CSS selectors within the same ''@nav'' category.
* ''@info'' serves as decription for the ''@navItem''element.
===== Dynamic content =====
==== Placeholders ====
With the help of placeholders, it's possible to access the fields of your user data or include dynamic content.
You can access each user data field if you place a ''$'' character in front of the field name. E.g., access the field ''name'' with ''$name''.
A list of all universally available placeholders is available with a click on the placeholder button inside the toolbar of a multiline editor.
If custom placeholders are requried please contact our support team via ticket.
=== Example ===
''$salutation_en_formal'' will be replaced with "Dear Mr. Doe," if the recipient is male, or "Dear Ms. Doe," if the recipient is female.
If no gender is given, it will fall back to "Dear Sir or Madam,"
==== Conditions ====
It is also possible to personalize content with conditions.
=== Example ===
== Personalized salutation with fallback ==
{!--
gender = 1 AND name != ""
Dear Mr $name,
gender = 2 AND name != ""
Dear Ms $name,
Dear Sir or Madam,
//--}
==== Functions ====
=== pn_substr ===
With the function ''pn_substr'' is possible to shorten the value of placholders to a specified amount of characters.
E.g.: ''pn_substr(name, 10)'' shortens the name to 10 characters.
==== Config Tags ====
Config tags make it possible to control the behaviour of the email editor.
^ Attribute ^ Type ^ Default ^ Description ^
| cssinline | boolean | true | Inline CSS from the \
/*******************
* Working examples *
*******************/
Lorem ipsum dolor sit amet
|
/***********************
* Non-working examples *
************************/
Lorem ipsum dolor sit amet
|
=== Values for storage ===
^ Value ^ Description ^
|frame | Save the contents from the preview iframe. This will save changes made via the browser's development tools but is also susceptible to foreign code, e.g., made by browser plugins, which could destroy the presentability of the email. |
|shadow | Save the contents from a shadow copy of the email. This assures that the email's source code could not be changed by browser plugins. |
{{tag> OTML Templates }}