New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Email templating in PHP
Building new app and looking for existing libraries for parsing html email templates to send email via PHP.
Example of HTML template.html:
Hello {{ user }},
Today is {{ date }}, a wonderful day to visit {{ url }}.
Now for PHP part I assume it would something like this (pseudo):
data['user'] = 'Name';
data['date'] = date();
data['url'] = 'lowendtalk.com';
SendEmail('template.html', $data[]);
Anyone knows library for "SendEmail" parser?
Comments
Use twig/twig, render the template separately and then use your typical email sending functions (PHPMailer, nette/email and the likes) to send the email.
are you using an MVC? Most have a way to output their view/blades into a variable.
You could then just feed that to your mail sending function as the body.
Francisco
why not this one:
moment
Looks like Mustache syntax - https://github.com/bobthecow/mustache.php
Script: https://pastebin.com/Dhbw74HD
This is exactly what I need! Clean and simple. Once again, LET crowd strikes and delivers. Thank you.
Just hit it with
No need for third party libraries.