Here's what I'm trying to do
Right now I have a bunch of "template" email responses stored in my DB, which are used frequently. Basically, what I'd like to do is for the templates, store things like ##CUSTOMER_NAME## and ##PRODUCT_NAME## in them. Then, when emailing, I'd like to pass an array of data (like, array("CUSTOMER_NAME"=>"Bob, "PRODUCT_NAME"=>"Widget") or whatever, depending on the particular email. There are also some basic if statements I want to execute, like if ##STATE## of customer == my state, say we'll charge you sales tax, or if ##STATE## in_array("CA", "WA", "OR") say "west coast" or something.
I'm guessing it would involve preg_replace and some for loops, but I'm not sure the most efficient way to go about this.
Any advice/suggestions appreciated. Thanks.