views:

26

answers:

2

partials and helpers seem to do similar things to me. only the way u use it, syntax, is different, so my question is whats the difference and when do u use one over the other

+1  A: 

well quoting from Matthew blog, from the Zend Team, http://devzone.zend.com/article/3412:

The big difference between rendering a partial and a normal view script is that a partial gets its own variable scope; it will only see the variables passed to it directly.

Yehia A.Salam
+1  A: 

A partial is exactly that, a partial bit of the larger presentation layer. A partial could be a menu, which is reused across many pages (or part of a layout).

In most cases, a helper is used for preparing data that will be rendered (by a partial for example).

A partial "menu" could use a helper which ensures every URL used in the menu is stripped of double slashes ("example.org/page/somevar/someval//otherval").

Andrei Serdeliuc