Search code examples
phpzend-frameworkviewzend-view

Zend Framework: Difference between View Partials & Helpers


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


Solution

  • 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").