I’ve been searching Google to try and find if Apache Velocity can be used with PHP but so far I haven’t found anything that says it can.
Does anyone know if this is possible or if there is an alternative method.
Basically what I’m trying to do is separate HTML emails out of my PHP code so that I can just have a load of template files and then fire them off when needed. That way I won’t have to write long strings of HTML code in a .php file.
Any help would be greatly appreciated.
Long strings of HTML code shouldn’t be needed, as PHP is a template language anyway. End PHP context with
?>then use<?php echo $myvar; ?>embedded in your HTML where necessary. Make your email templates separate PHP files and include them to make the template solution complete.There are other PHP-based template solutions as well, so no need to look to Velocity (which positions itself as an alternative to PHP right on its overview page). This has been discussed at length on Stack Overflow. One good discussion is here: