Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional variable/tags in email campaign text #1050

Closed
fulldecent opened this issue Aug 15, 2024 · 2 comments
Closed

Conditional variable/tags in email campaign text #1050

fulldecent opened this issue Aug 15, 2024 · 2 comments

Comments

@fulldecent
Copy link

Hello, I am preparing my first campaign in phpList, coming from Mailchimp. And I am trying to implement this kind of mail merge:

Checking in to let you know your certifications are expiring.
*|IF:ACLSEXP|* * Your ACLS expires *|ACLSEXP|* 
*|END:IF|**|IF:BLSEXP|* * Your CPR/BLS expires *|BLSEXP|*
*|END:IF|**|IF:PALSEXP|* * Your PALS expires *|PALSEXP|*
*|END:IF|**|IF:NRPEXP|* * Your NPR expires *|NPREXP|*
*|END:IF|**|IF:MTEXP|* * Your Monitor Tech certification expires *|MTEXP|*
*|END:IF|**|IF:BBPEXP|* * Your Bloodborne Pathogens expires *|BBPEXP|* *|END:IF|*

and

*|IF:CORPCODE|*https://www.XXX*|CORPCODE|**|ELSE:|*https://www.XXX*|END:IF|*

I understand the second one is easier, I could update my data source to address that.

For the first one, lines are shown or not shown in the template based on conditions (i.e. whether a variable is or is not empty).

Has anybody found a workaround for this workload? Or has anybody considered implementing conditionals in phpList's templating language, or adopting another language like php-liquid as the templating language?

Workarounds

I am considering to add extra attributes to my email list to address my specific problem above. For example I would use [LINE1] / [LINE2] / [LINE3] / [LINE4] and fill in those lines based on the first, second, third, fourth, ... expired certification.

Then in my template I would directly include [LINE1] / [LINE2] / [LINE3] / [LINE4]. The last lanes would be blank depending on how many certifications there are and the recipient would just see blank lines.

"Free"

I do understand that phplist3 is free software and anybody could implement this feature request but is under no obligation to support me.

I am opening this issue in the interest to find other people that may have also considered this use case. And also I would like to ask the maintainers here if there is appetite to merge a PR if such a feature is provided (and which design approach(es) may be acceptable).

Thank you!

@fulldecent fulldecent changed the title Conditional in email campaign text Conditional variable/tags in email campaign text Aug 15, 2024
@bramley
Copy link
Contributor

bramley commented Aug 17, 2024

There is a plugin that does something similar, see https://resources.phplist.com/plugin/conditionalplaceholder

It is no longer supported but could be used as-is, but you would need to fix any problems yourself, or as a starting-point if you wanted to implement different syntax.

@fulldecent
Copy link
Author

Thank you @bramley that looks great.

I will look into using this and fork and supporting that project.

However at the moment, this is blocked for me at #1049

Closing here as this might be out-of-scope for phplist since it can live in a module.

@fulldecent fulldecent closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants