Skip to main content
Skip table of contents

Using Velocity in the Custom CSS

To have one single template for a number of situations you can work with Velocity syntax. Using Velocity syntax in your template, you can dynamically control the output depending on the information stored in a placeholder. Below are some examples for controlling the output:

Having different product logos depending on the exported variant

Using our content management add-on Scroll Versions, you can have multiple variants within the same space. Depending on the variant, you can have a different product logo in the header or footer of your exported PDF file.

To have different product logos depending on the variant:

  1. Open your template and click Page Layouts.
  2. Depending on the position where you want to insert the product logo, click Enter Custom in the drop-down list.
  3. Enter the following lines of code:

    Example: Having different product logos for different variants

    CODE
    #if ($scrollVersions.Variant.Name == "PDF")
        <img src="pdf-logo.png" />
    #elseif ($scrollVersions.Variant.Name == "HTML")
        <img src="html-logo.png" />
    #else
        <img src="generic-logo.png" />
    #end

    When you export a variant with name "PDF", an image with name "pdf-logo.png" will be displayed in the header or footer, when exporting variant "HTML", an image with name "html-logo.png" will be displayed in the header or footer, when displaying all other variants an image with name "generic-logo.png" will be displayed in the header or footer.

    Example: Having different text based on labels of the root page

    CODE
    #if ($page.labels == "PDF")
        This page is valid for PDF files
    #elseif ($page.labels == "HTML")
        This page is valid for HTML files
    #else
        This page is valid for all file types
    #end

    When you export a variant with label "PDF", the text "This page is valid for PDF files" will be displayed in the header or footer, when exporting a page with label "HTML", the text "This page is valid for HTML files" will be displayed in the header or footer, when exporting any other page, the text "This page is valid for all file types" will be displayed in the header or footer.

  4. Click Save.

Having different imprint or legal pages depending on the exported language

Using our language add-on Scroll Translations, you can have multiple languages within the same space. Depending on the language you are exporting, you can have a different imprint page (or other static pages) in your exported file.

To have a different imprint page depending on the exported language:

  1. Open your template and click Static Pages.
  2. Add a new static page.
  3. Enter the following lines of code:

    CODE
    #if ($scrollVersions.Language.Key == "de")
        <h1>Impressum<h1>
    	...
    #else
        <h1>Imprint<h1>
    	...
    #end
  4. Click Save.

When you export language German, the heading "Impressum" is displayed, whereas when you export another language, the heading "Imprint" is displayed.


Having different background images depending on the page status

Scroll Versions comes with a workflow implementation. Depending on the status of the root page (the page you start the export from) you can have different background images.

To have a different background image page depending on the status:

  1. Open your template and click Content Formatting.
  2. Enter the following lines of code:

    CODE
    @page {
    	border: 1mm solid black;
    	
    	#if ($scrollVersions.State.Name == "draft")
    		background-image: url("draft.png");
    	#elseif ($scrollVersions.State.Name == "review")
    		background-image: url("review.png");
    	#else
    		## no background image for completed pages
    	#end
    	...
    }
  3. Click Save.

When you export from a page in status "draft", the background image "draft.png" will be displayed in all exported content pages, when you export from a page in status "review", the background image "review.png" will be displayed, when the root page is in status complete, no background image will be displayed.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.