XF 2.0 Pagenav link

CMTV

Well-known member
Hi!

I have this code:
HTML:
<xf:pagenav link="{{ link('members/bestAnswers', $user) }}" page="{$page}" perpage="{$perPage}" total="{$total}"
            wrapperclass="block-outer block-outer--after" />

The problem is in dublicate index.php? in result:
Code:
http://question.threads/index.php?/index.php?members/cmtv.1/bestAnswers&page=2

Is there a way to remove redundant index.php?
 
I tried this code:
HTML:
<xf:pagenav link="members/bestAnswers" data="{$user}" page="{$page}" perpage="{$perPage}" total="{$total}"
            wrapperclass="block-outer block-outer--after" />

But here is what it produces:
Code:
http://question.threads/index.php?members/cmtv.1/page-2/bestAnswers

And I need this:
Code:
http://question.threads/members/cmtv.1/bestAnswers?page=2
 
Solved it!

For some reason XF addes index.php? to members/... link types so it is not possible to add ?page=2 to the end of the link. No way to get this:
Code:
http://question.threads/members/cmtv.1/bestAnswers?page=2

Moreover, this means method $this->filterPage() in controller will be always returning 1 (because there is no ?page=2 url parameter).

The only way to get all this working is reading page-2 part of URL:
Code:
http://question.threads/index.php?members/cmtv.1/page-2/bestAnswers

This can be done by replacing $page=$this->filterPage() with $page=$params->page in controller.
 
Back
Top Bottom