5.8. Customizing the Previews

Prev Next

This chapter is about how to create necessary view for each of page used in Briefing.

5.8.1. Template-based Preview


There is a way you can customize a preview by uploading xml file to Briefing System module configuration > Preview Templates.

image083.png

Template-based preview is built with a help of the uploaded XML as a template. Products are placed on a preview due to position of the Priority Field (mapped in Briefing System module configuration > Products on Briefing > Field with Priority) in the XML template. For example, using next xml:

<?xml version="1.0" encoding="UTF-8"?>
<Table>
    <TableRow>
        <TableData id="Crazy price" />
        <TableData id="Total sale" />
    </TableRow>
    <TableRow>
        <TableData id="-" />
        <TableData id="New Price" />
    </TableRow>
    <TableRow>
        <TableData id="" />
        <TableData id="Oldschool" />
    </TableRow>
</Table>

We will get a page Preview with 2 columns and 3 rows where corresponding products will be placed sorted accordingly to XML template

image085.png

In the example above there is no product that matches priority to be used in Preview Template.

When Use Templates for Preview option is enabled in Briefing System module > Settings, additional column Template is added next to Page Name in Edit Briefing window and displays name of the template selected for a Page. Template name is also displayed on a Page and Briefing Views next to Headline Name.

5.8.2. XSLT-based layout display


When it is needed to have a preview of the campaign in the way it should look in production –xslt template can be used. Once uploading XML template that contains xsl — additional tab Layout will be available from Page and Briefing Previews

Note!

Both Templates for Template-based and Layout tabs should be included to the single xml file.

<?xml version="1.0" encoding="UTF-8"?>
<Template>
    <!-- Template Display part -->
    <Table>
    ...
    </Table>
    <!-- Layout Display part -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    ...
    </xsl:stylesheet>
<!--END-->
</Template>

There are various ways how the XSLT template can be structured. However we can provide some recommendations.

There are some basic steps to do:

  • Start with defining grid in cells of which products will be placed;

  • Define named templates for different product layouts;

  • Fill grid cells markup with call to product layout templates passing product selected by priority or other attribute;

So in the end you will get preview like this:

image087.png

As it has been already mentioned this preview is based on xsl transformations. So to configure those we need to know the structure of the XML provided by the system. Upload the template with the following content and select it for a page in order to get the XML structure of the page which you will need for creating layout preview templates:

<?xml version="1.0" encoding="UTF-8"?>
<Template>
<Table/>
    <xsl:stylesheet version="1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" indent="yes" media-type="text/xml" version="1.0" encoding="UTF-8"/>
        <xsl:template match="/preview">
            <xsl:copy-of select="."/>
        </xsl:template>
    </xsl:stylesheet>
</Template>

Open Page Preview in the Layout tab of recently created template and check the source code of the page.

image089.png

On the screenshot above you may see XML structure for a page that can be used to build layout view. To make it easier to configure — please check next key nodes:

Node

Description

<preview>

The root node

<page id="1" templateId="36" templateName="Template">

Page node, contains information from a single page. Attribute id — is the identifier of page field object

<briefing id="643" name="BriefingName">

Briefing node, contains the information about current briefing

<headlines>

Parent node for each of headlines on the page

<product priority="1" departmentId="31" departmentName="Sales" headlineId="21" headlineName="Headline">

Product node contains information regarding headline and department responsible for the product.

Note! Priority is stored as node’s attribute, so if no priority is set for a product — attribute will be absent

<fields>

Node contains list of product fields as child nodes. List of fields is the same for each product and differs only by field values. Node is also present for , ,  parent nodes.

<subProducts>

Parent node for each of products that are actual sub products.

<logos>

Parent node for each of product logos

<pictures>

Parent node for each of product pictures

<pageElements>

Parent node for page elements

<columnNames>

Node is used to define column headers for page elements

<row>

Page elements table contains arbitrary number of rows. Structure of each row is the same — only column values differs

<column>

Column node is holding data. The Name of the column is specified. besides name column contain either 'text' element with text data or 'image' element if this column holds image

5.8.2. AdBuilder based layout display


It is possible to use AdBuilder template for representing the Products on the page. In this case, you will be able to use the functionality of AdBuilder to visualize and save the pages with products as composed PDF.

1. Go to Briefing System module configuration > Preview Templates.

... in progress