Zend \ Paginatorを使用してページ区切りの結果セットを作成しています。ただし、検索フォームを追加した後は、この2つを一緒にうまく組み合わせることはできません。ZF2のページネーションURLにクエリパラメータを保持するにはどうすればよいですか?
ページ上の検索フォームで生成URLは次のようになります。それは生産のURLで検索語を保持するように
user/index/?searchTerm=hello
どのように私はZendののページネータの設定を修正しますか?
私のような何かを期待していた:私は何をしないのです
user/index/page/4/?searchTerm=hello
?
echo $this->paginationControl(
$this->users, 'sliding', array('paginator', 'User'), array('route' => 'user', 'action' => 'index')
);
ページ区切りテンプレートスニペット:
<li>
<a href="<?php echo $this->url($this->route, array('action' => $this->action, 'page' => $this->next), true); ?>">
Next »
</a>
</li>
'user' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/user[/[:action[/]]][[id/:id]][/[page/:page]]',
'defaults' => array(
'controller' => 'Application\Controller\User',
'action' => 'index',
'id' => null,
),
// the below was added to try and get the searchTerm query to be retained
'may_terminate' => true,
'child_routes' => array(
'searchTerm' => array(
'type' => 'Query',
),
),
),
),
は改ページビューでこれを使用して構築されている次のよう
モジュール設定ルートが定義されています
(私は印はtrue
をthird parameter to url()
would retain the query paramsとしています)