On Sat, Mar 28, 2009 at 11:22 AM, Philip Iezzi <[email protected]> wrote:
> I partially agree with the "Smarty is no longer needed" opinion. During the
> last months I changed all my ZF projects back to Zend_Layout/Zend_View,
> eliminating Smarty. But I still need Smarty for simple email body
> templates...

I think you can use views all the way.

For example:
<!-- email.phtml -->
Dear <?=$this->escape($this->firstName)?>

Thanks for registrering at <?=$this->siteName?>!

Cheers,
Webmaster

And in your controller, you'd do:

$this->view->assign('firstName', $firstName);
$this->view->assign('siteName', 'example');
$emailBody = $this->view->render('email');

// continue with Zend_Mail etc. here

> Why does nobody mention the (in my eyes) horrible bug (it's definitely not a
> feature!) in PHP itself that was last discussed in 1998 and then somehow
> accepted by the community as a "feature": PHP eating newlines after the
> closing tag
> http://brian.moonspot.net/php-history-newline-closing-tag

I think that is why people like to omit the closing tag.

Generally, there are ways to make it more pretty or to force a format.
Can you give a more detailed example as of where your problem is?

> AFAIK, PHP still doesn't give us the option to turn off this nasty behavior.
> I didn't hear of an option in PHP 5.3 either. Please let me know, if I'm
> wrong.
> Some Smarty templates really start to look messy with all those extra
> newlines after closing tags if I switch from Smarty to Zend_View.

I don't understand exactly where they look messy. Details. ;-) Point
taken, HTML/PHP mixed doesn't look pretty -- then again, when people
use my website, they view it through a browser which renders it all
pretty and they don't have to look at the source code.

HTH,
Till

Reply via email to