ZF-6805: Zend_View_Helper_PaginationControl should render with no partial set


Currently, when you don't set the partial for paginationControl, it just throws an exception. But, IMHO, you could render a decent paginator without it being required. Say

« 1 2 4 5 »

This would lower the requirements for using it.


The params needed for this would be the HTML for the first/last, prev/next combo, the name of the URL param (which could default to "page") for the url() view helper and the route name (defaulting to... well, "default"). Maybe, if feeling really generous, one could supply an "attribs" param which would get embeded to


ul> itself (defaulting to array("class" => "paginator"); I reworked the paginationControl helper by adding __toString() and render() as paginationControl() returns $this.

This would enable cuszomizing the paginator rendering per instance, like:

echo $this->paginationControl()->setPaginator($this->paginator)->setParamName('p')->setParamRoute('articles');

Postponing this issue. In the early prototypes of Zend_Paginator this features was available, but after giving the feature a lot of thought we opted to include good examples in the manual instead. If something like this is attempted it should probably be done in a separate view helper to not clutter the current one too much.

A separate helper is fine, but then you have an issue of "Which is the proper one?" Why was the rendering without partials droped?

The examples in the documentation exist for this very reason, and I think the documentation is pretty clear in this respect. I think a separate view helper would be more confusing.

I don't get the reasoning behind your comment. The component should be able to render itself without requiring an additional view file, much like for example Zend_Form or Zend_Navigation. I don't understand why you'd go for breaking this pattern here and opt for "it all in the doc" stance.

I kinda agree here, (sorry Norm2782). I don't see the problem in providing a few standard partials or view helpers with ZF (those of the documentation maybe? :D).

Dalibor: To be fair, Zend_Navigation was only recently released, so prior to the inclusion of Zend_Paginator in 1.6 only one component was released that did this. One component is not really a pattern, and therefore Zend_Paginator is not really "breaking" anything. :-)

Dolf: I'd more than likely be the one to implement this issue; that's why I assigned it to myself.

After considering a simpler way of solving this (simply including a default view partial under Zend/View/Helper/PaginatorControl/default.phtml) I will re-mark this as postponed until I get some time to do it. However, a patch (with unit tests) will help speed up the time to completion if one of you would like to submit one. It would be appreciated.

Well, the "pattern" might have been an overstatement, but atleast you've changed the WONTFIX attitude so it kinda worked. :) Anyway, as you're proposing adding the first view partial (AFAIK), maybe the core devs should discuss the best place for it (naming scheme, etc.). I could submit a patch for this, it'd get my feet wet.

That's a good point. I'll raise the issue on the mailing list.