NYCPHP Meetup

NYPHP.org

[nycphp-talk] heredoc string formatting question

Cliff Hirsch cliff at pinestream.com
Fri Aug 11 14:46:08 EDT 2006


I was going to annoy David with an offline request regarding how this is
done, but the solution is interesting enough to share with the group.

In the past I have intentionally used the bare minimum of Smarty
functionality, thinking as others here have noted that PHP is already a
templating language in some respects. That mean I have only used the
Smarty Display command, so I couldn't figure out a way to access the
compiled and parsed template.

Turns out it couldn't be easier.

See: http://smarty.php.net/manual/en/api.fetch.php

Fetch returns the template output -- easy. And the bottom of the page
listed above provides an email template example. Using this solution
coupled with FCKeditor to allow any admin to customize the template has
real possibilities. The Smarty get_template_vars() function could
probably be used to show an admin what the potential "custom" variables
are.

Thanks to David for pointing out that this approach works.

Cliff
-----Original Message-----
On Thu, 10 Aug 2006, Cliff Hirsch wrote:
> One though I had was to use Smarty to generate tpl files for the email
> bodies, letting it do the parsing and compiling.
>
> Thoughts? Comments?
I have used the Smarty approach, with good results.
---
David Mintz
http://davidmintz.org/




More information about the talk mailing list