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.
I recommend using a text editor that supports the XML language. Notepad ++ is one of them.
In case you want to include images, everything has to be in the same compressed file (.zip).
You will have to match the information you want to put in each field of the XML template with the fields of its labels.
Blocks will be visible/invisible depending on whether or not a condition is met. So when your blocks are configured, the template will have its own dynamism.
“Forget about static templates, show what you want to show and the way you like it”
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>
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 “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.
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.
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.
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.