I have a page that displays a lot of data, including Zend_Paginator.
The page action is /po/fetch?id=someID
.
what i want to do is to pass the "id" parameter to zend paginationControl so the pagination links will be something like /po/fetch?id=someID&page=somePage
. unfortunally i can't find anywhere explanation on how i can pass that parameter to the paginationControl.
my call to paginationControl:
echo $view->paginationControl($paginator, 'Sliding',$control, $params);
where $params = array('id' => someID
and my pagination partial is:
<a href=<?= $url.'&page='.$this->first; ?> id="first"> First </a>
<a href=<?= $url.'&page='.$this->previous; ?> id="previous">< Previous</a>
<?php
foreach($this->pagesInRange as $page) {
?>
<a href="<?= $url.'&page='.$page; ?>">.$page.</a> | ;
<?php
}
?>
<a href=<?= $url.'&page='.$this->next;?> id="next"> Next ></a>
<a href=<?= $url.'&page='.$this->last; ?> id="last"> Last </a>
and I want $url
to be of the specified form.
Hey Try this, It will surely work.....
Here
1
is given as the id you have to pass the id you want....... LikeI have gone through the same issue so I have used code given below in partial paginator.
I have created a function in paginator partial view file(
control.phtml
) or may be different.Now for links I am using code given below.
Instead of
I am sure it will be helpful to others as well.
Your example code doesn't show how
$url
is populated, but you really should be using the URL ViewHelper.So, for example - your previous link would become:
This will return a proper URL to the current page with the
page
parameter set to$this->previous
. So if the current url is/users/view?foo=bar&page=5
, the above code would output/users/view?foo=bar&page=4
for the previous link. Notice how any query parameters that are already present are preserved.So, if the
id
parameter is already present on the URL showing your paginator, the above code will "just work". However, if you still need to add theid
parameter, you can do so like this:To continue from our previous example, this code would output the following url:
/users/view?foo=bar&page=4&id={someId}
Here is the reference documentation for the URL ViewHelper:
One last note - the
$reset
(third) parameter of the URL ViewHelper will come in very handy. The default behavior is to preserve any query parameters of the current request but calling$this->url(array(), 'default', true)
withtrue
for the$reset
parameter will basically remove all parameters except for the ones you specify in$urlOptions
.