Although I’ve been playing with Lithium for a few weeks, I haven’t needed to touch the view at all and barely looked at the Controller, so I didn’t really pay attention to this difference until just now…
In Zend, you set the vars in the controller for the view thusly.
Whereas in Lithium, you do it thusly.
Then in the view, to access those vars, here’s how Zend Framework does it.
With Lithium, if you use the same notation as the PHP short open tag, it will automatically escape the output. Which is great, although keep in mind that when you don’t want an htmlspecialchars escape, be sure to escape the var yourself as appropriate. Here’s the Lithium example.
I’m not sure how Zend Framework 2.0 will work yet. Been too busy to keep up to date.
I think the Lithium way is quite elegant. It’s a lot easier to explain to front end people who are mostly but not 100% in the view. There’s a variable, it’s the same in the controller and the view and you just access it.
It’s always good to check out different frameworks and learn what you can from each of them.
Aside: I love how people in the PHP community are for the most part really good about listening to the good and less good with an open mind and not making it personal. Matthew Weierophinney’s recent article about Filters and Nate Abele’s response is a classic example of the class acts in our community. I’ve learned much from all of you.