fepli
ManualReferenceSystem and data protectionAdmins

PDF and XML templates

A PDF template sets how the programme booklet looks. An XML template delivers the same details as data, for example for a typesetting program.

You write both types in the editor of the export templates in Twig, a language for templates. What applies to all templates is described there.


What fepli makes of the template

A PDF template writes HTML, the language of web pages. fepli sets it into the pages of the PDF with the program mPDF. An XML template is output as it is written. fepli only writes the file, though, once the XML is well-formed, meaning every element is opened and closed correctly.


Page and font

Only a PDF template has these settings.

FieldMeaningValuesDefault
Page sizeSize of the pageA4, A5, A6A4
Portrait, LandscapeOrientation of the pagePortrait, LandscapePortrait
Margins in mmDistance from the edge of the page: Top, Right, Bottom, Left0 to 4015
Base fontFont of the whole document, from the supplied and the uploaded fontsName of a fontGeist
Font sizeSize of the base font in points (pt)6 to 24, in steps of 0.511

Source text and preview

The middle shows the source text of the template with line numbers. Below it, the status bar shows “No errors” or “Line {line}: {message}”; the faulty line is marked red.

On the right you switch between two views:

ViewContent
PreviewThe result with the first offers of the season that currently has an editing phase. If it has no offers, fepli uses sample offers. A PDF appears with its pages, an XML as text.
VariablesThe details that can be inserted (Variables). An entry inserts its text at the caret.

If the template has an error, the preview shows “Preview not possible” with the message and the link Go to line {line}.


Variables

A variable is a placeholder that fepli replaces with a detail of the offer. The PDF template receives the offers as items, the XML template as offers. In the table, list stands for this list.

VariableContentApplies in
listThe offers of the export. The entry inserts a loop for offer in … that repeats for each offer.PDF, XML
offer.nameTitlePDF, XML
offer.numberOffer numberPDF, XML
offer.teaserShort descriptionPDF, XML
offer.descriptionDescription, prepared as on the website. Embedded HTML and unsafe links are dropped.PDF, XML
offer.datesDates with begin and endPDF, XML
offer.minAge, offer.maxAgeAge from, age toPDF, XML
offer.feeFee in euros or francs, as setPDF, XML
offer.meetingPointMeeting pointPDF, XML
offer.bringWhat to bringPDF, XML
offer.applyTextNote on applying when this does not run through fepliPDF, XML
offer.hostsOrganizers with namePDF, XML
offer.categoriesCategories with namePDF, XML
offer.propertiesOwn properties with Print in the booklet, with label and value (Settings)PDF, XML
edition.nameSeasonPDF, XML
todayDate of the exportPDF, XML
imagesLogos of the organizers with path and dimensionsXML
<pagebreak />New pagePDF
{PAGENO} / {nbpg}Page number in header or footerPDF
<htmlpagefooter>Footer on each pagePDF
var:tenantLogoLogo of the instance, e.g. <img src="var:tenantLogo" height="18mm" />PDF
loop.index, loop.lastCounter in loopsPDF, XML
dateFormats a date, e.g. date('d.m.Y')XML
<![CDATA[ … ]]>Text with special charactersXML

Rules

RuleContent
Permitted TwigA template may only use a selection of Twig’s commands. A variable that does not exist is an error.
Images and links in the PDFTheir addresses must begin with var:, data: or #. fepli removes every other address. Files of the server never get into the PDF.
Fonts in the PDFfont-family names a font from the fonts.
Colours for printcmyk(C, M, Y, K) with values from 0 to 100, e.g. color: cmyk(0, 85, 90, 0). The PDF holds them in CMYK, the preview and the PDF studio show them approximately. Images keep their colours.
PDF studioThe PDF studio finds the offers’ pages if the template writes them in a loop over items, one section per offer.
Adjustments from the PDF studioHold for this template and this offer until one of the two changes (Origin).

Messages

MessageMeaning
“There is no variable “{name}” here.”The template uses a variable that does not exist. The list Variables shows the right names.
“There is no field “{name}” here.”The offer has no field of this name.
“There is no filter “{name}”.”, “There is no function “{name}”.”Twig knows no command of this name.
“The tag “{name}” is not allowed in export templates.”, also for filters and functionsThe command exists, but export templates may not use it.
“A block is not closed – is endfor or endif missing?”A for or if has no end.
“The output is not valid XML: {message}”The result of an XML template is not well-formed. fepli does not write the file.