开发者

using partials in view helpers

Creating custom Zend View helpers I often end up with something li开发者_开发技巧ke:

// 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?


I have ended up with view helpers (using services) and rendering the partials inside helpers.

There is an option to have logic in partials too, but in the long run. this is not the best solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜