gladtolinkblog

XML Dynamic templates

Engracia Villar

Engracia Villar

Share on linkedin
Share on facebook
Share on twitter
Share on google
Share on whatsapp
Learn how to create and use XML templates

XML templates offer great dynamism as their fields get adapted to the information you enter.

 

 

You can create visible or invisible blocks according to certain conditions, in such a way that the final template generates the content and its display according to the established conditions.

Steps to be followed

“Forget about static templates, show what you want to show and the way you like it”

Create the XML template

Notepad ++ image, configuring an XML template.

Creating the template

The first thing you have to do is open your Notepad ++ or a similar one, create a new document and change the language to XML. So go to the toolbar and look for the “Language” tab. Select XML.

To create an XML document you must use xml tags or tags that serve as a start and end command for any function. There should always be a start and an end tag. Otherwise it will show an error when finishing the document.

Example of the usual XML syntax

All the content of your document goes inside these labels: <xml>Content</xml>

 

  

Another important tag you should use is: <block>Block Content</block>

 

 
This tag is very important for your document since it will allow you later to hide those blocks you do not want to be seen, according to the conditions you define.
 
It is very useful to put an identifier to each block in order to find it when setting the conditions to hide it or not. To know how to do it, look further down in this document.
 

The ID attribute is essential



The ID is the key attribute (identifier). Must be descriptive to make it easy to find.

You have the possibility of matching the fields  intelligently, searching for the fields through their names and linking them with the best results. So ID field similar to names increases the ease of mapping fields to each other and avoids doing it one-by-one by hand.

Basic structure of an XML

In the image example, the first block contains a field:<field>Logo Image<field/> and descriptive text <-text>Descriptive Text<text/>

In this case, the logo image will be inserted into the field. 

 
The attribute “position” defines the logo position. In the example, “center” has been chosen, but it can be “left” or “right”.

 

The “src” attribute shows the path of the Logo image. You must incorporate that image into the zip document that you will upload later on the GladToLink platform as a new template. 

 

 

You can also define the size of the field with the attributes width and height.

 

 

Remember to end each attribute with its closing tag.

The tag <br/>introduces a line break.

 

 

Font is the font or font style. Font = “bold” will show the letter in bold. Fontsize allows us to change the font size: big, normal, small. 

It is convenient to put a general block for the content of the document, so if you want to show only the logo and the name of your company it would be very easy to hide the general block.

The attribute ID, refers to the identifier of the field or block of the template, so it can be identified and linked later.

Compress XML to ZIP

Image of the template container

Compress the XML file into a ZIP with everything you need to make it work. Remember to put the images you need to use in the root of the .zip



Now you just have to upload the new template. In the section: Automatisms – Templates. Click on the “+” button located on the top right.

 

In this template creator tab, you can give the template a name, download it, and upload a new one.

Match the file

Add the tags

In order to link the template with your data, you will have to add the tags that contain forms with the fields that you need to link or map.

Tag section in template creation

Make the links

In this section you will specify which field of the tag form should be linked to the field of the templates.



Here you will find the XML template fields that contained an ID.



And on the right you have the formulas to choose the fields you want from the system calculator.

Smart link: At the top right you will see a magic wand. When you click on it, it will search for all the fields that have similar names and will try to link the best options.

Template links

Block conditions

Make the dynamic template with the Block Conditions

Finally, there are blocks conditions. 

In the event that a block does NOT have a condition, it will always be visible and, if it has a condition, it will only be visible when this condition is met.

Block conditions

Compártelo
Share on linkedin
Share on facebook
Share on twitter
Share on google
Share on whatsapp

Leave a comment

ARTÍCULOS RELACIONADOS