• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

pagenav with search


I would like to have a pagenav (<xen:pagenav>) in a template which shows search results. I'm struggling to set it up so that it still shows the search results when i go to the next page.

In the template I have the following two possibilities:
<xen:pagenav link="teams" linkdata="{$search}" page="{$page}" perpage="{$perpage}" total="{$totalTeams}" />
<xen:pagenav link="teams" page="{$page}" perpage="{$perpage}" total="{$totalTeams}" />
The upper produces these links:
The lower produces these links:
Is there a way to combine the two, so I get the following links?
My current route
class LoLCompetition_Route_PrefixPublic_Teams implements XenForo_Route_Interface
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
        $action = $router->resolveActionWithIntegerParam($routePath, $request, 'team_id');
        $action = $router->resolveActionAsPageNumber($action, $request);
        return $router->getRouteMatch('LoLCompetition_ControllerPublic_Teams', $action, 'lolcompetition');
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
        if($data && !empty($data['search'])){ $extraParams['search'] = $data['search']; }
        $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
        return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, "team_id", "name");
Important parts of the controller
$options = XenForo_Application::get('options');
$perpage = $options->lolcompetition_teams_perpage;
$search = $this->_input->filterSingle('search', XenForo_Input::STRING);
$page = $this->_input->filterSingle('page', XenForo_Input::UINT);
$viewParams = array(
  'teams' => $this->_getTeamsModel()->getTeams(/*...*/),
  'perpage' => $perpage,
  'totalTeams' => $this->_getTeamsModel()->getTeamCount(/*...*/),
  'page' => $page
  $viewParams['search'] = array('search' => $search);
return $this->responseView("LoLCompetition_Teams_List", "lolcompetition_teams_list", $viewParams);
I found a solution which works for me on my own now.
Do I get the 10$ now Kartus? ;P

I will not post the complete solution here. I don't have time for such a huge post^^
I will give a hint though. I used the following code in the template:
<xen:pagenav link="teams" linkparams="{$search}" page="{$page}" perpage="{$perpage}" total="{$totalTeams}" />


Well-known member
For all those still wondering how to do something like this.
1. Pass the a variable from the controller to the template. Just for the example let us name it $linkParams
2. Make $linkParams an array of key-value pairs.
$linkParams = [
'search' => 'searchstring',
'type' => 'google'
3. Use it in the template like
<xen:pagenav link="teams" linkparams="{$linkParams}" page="{$page}" perpage="{$perpage}" total="{$totalTeams}" />
Now the URL should look like