using partials in view helpers

Posted by takeshin on Stack Overflow See other posts from Stack Overflow or by takeshin
Published on 2010-06-11T11:58:10Z Indexed on 2010/06/11 12:03 UTC
Read the original article Hit count: 210

Creating custom Zend View helpers I often end up with something like:

// logic here
if ($condition) {
    $output = <<<EOS...
} else {
    $output = <<<EOS...
}

or using switch.

Then to eliminate this, I create setPartial(), getPartial() and htmlize() for using external .phtml's.

This is not the best solution, because partials do not support doctype changing.

  • Is there any better solution, than creating abstract class handling this common case?
  • Are there any ready Zend solutions for this case?
  • Separate view helper for each case? And where to put common code?

© Stack Overflow or respective owner

Related posts about mvc

Related posts about design-patterns