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?