Announcement

Collapse
No announcement yet.

PDF template: #each and #ifEqual ...?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PDF template: #each and #ifEqual ...?

    Hi,

    I have several multi enum fields, which I want to enclose in PDF output. As an example, in my template I use

    <ul>{{#each handling}}<li>{{./this}}</li>{{/each}}</ul>

    This works well. Unfortunately, because of a data import that I cannot quite change, "handling" contains values like "wissen-vermitteln" (i.e. no capitals, no blanks). As TCPDF obviously takes values directly from the database, I get "wissen-vermitteln" printed in my PDF. What I want, is "Wissen vermitteln" instead. My idea was, to include an #ifEqual in the #each clause, such as

    <ul>{{#each handling}}
    {{#ifEqual {{./this}} 'wissen-vermitteln'}}
    <li>Wissen vermitteln</li>
    {{/ifEqual}}
    ...
    {{/each}}</ul>


    In fact, I get an error like

    Wrong variable naming as '{{./this' in {{#ifEqual {{./this}} ! You should wrap ! " # % & ' * + , ; < = > { | } ~ into [ ]

    I cannot figure out, how to do this correctly. Whatever combination of brackets I use, it just does not work.
    So, is there a way to use {{./this}} as a variable in this attempt?

    Kind regards

  • #2
    Got it!
    It should read

    {{#ifEqual ./this 'wissen-vermitteln'}}

    so, without curly brackets around "./this"!

    Comment

    Working...
    X