busboy — 2013-04-04T15:59:28-04:00 — #1
I store all outgoing emails in a database. A cron wakes up every 30 minutes to send out the next batch of emails. Up until now each of the 15 different types of email were all plain text, but I plan on moving to html based templates. Would it be more efficient to call all 15 email templates at once, even though not all of them may get used in a particular run? Or would it be more efficient to call the templates as needed in my DO WHILE loop even if that means calling certain templates over and over? Does this make sense?
$importedBody = file_get_contents('emailTemplates/hero.html');
jgetner — 2013-04-04T19:55:25-04:00 — #2
I would pull them one at a time then cache them for later use.
starlion — 2013-04-04T20:16:27-04:00 — #3
As stated somewhat ambiguously by jgetner, the answer is 'neither'.
Assuming that the templates in question are not excessively large, pull them as-needed and store them in an array for reuse.