if else statement in template

hostbox

Member
Hi.
Not enough #IF# #THEN# #ELSE# structures in the letter template (as implemented in the mailchimp). somebody already solved this problem?
 
You can manually create custom fields or add your own statements or if you massivly rely on dynamic content like i do you can generate your template server side then upload it with the given users details using file_get_contents.
 
You can manually create custom fields or add your own statements or if you massivly rely on dynamic content like i do you can generate your template server side then upload it with the given users details using file_get_contents.
Creation and use of their fields this is a standard functionality of mailwizz. BUT I can't find in the standard functionality of conditions (IF, THEN, ELSE).

For example,

Hello [IF:FNAME]
[FNAME],
[ELSE:]
Friend,
[END:IF]

Like mailchimp conveniently implemented: http://kb.mailchimp.com/merge-tags/smart/use-conditional-merge-tag-blocks
 
In /mailwizz/apps/common/components/utils/EmailTemplateParser.php

I change from false to true "public $keepBodyConditionalTags = true"

What format to write the conditions?
 
@hostbox - that property of the class is sued for something totally different, it has nothing to do with the actual template tags.
As i said a few times, right now the template engine is really silly, it can only replace things, it doesn't know about conditional tags like if/else/elseif and this isn't a easy addition to do so i don't have an eta for when such thing will b added.
 
Thant's great news. I have enabled it but having some problems?
I have a custom date field "created_at". When I output it directly like this: [CREATED_AT] it works perfectly and prints 2016-06-21

However if I try to use it in a Twig formula like this: {{ [CREATED_AT]|date(dd-YYYY) }} I get all sorts of errors. If I use quotes like this:

{{ [CREATED_AT]|date("d/m/Y") }}
and save, it removes one and returns like this {{ [CREATED_AT]|date("d/m/Y) }} which of course fails. I have tried no quotes, single quotes, etc but no luck. Any recommendations?
 
{{ [CREATED_AT]|date("d/m/Y") }} and save, it removes one and returns like this {{ [CREATED_AT]|date("d/m/Y) }}

what happens if u put two quotes where you need one to remain after save
{{ [CREATED_AT]|date("d/m/Y"") }} to get {{ [CREATED_AT]|date("d/m/Y") }}
?
 
I tried this... {% IF FNAME|LOWER == 'Neil' %}Yes It's Neil{% ENDIF %}{{FNAME}} Did not work... in that the email that gets sent out prints the actual conditional statement and not the output... I do have the template engine parser turned on... Any ideas on why its not working

Also on latest version of MW

Thanks
 
Back
Top