XF 2.0 Pagination fails with Demo Portal tutorial but works with the attached source code

abdfahim

Well-known member
I wrote the whole addon manually rigorously following the tutorial page.

Then I set 9 threads as featured and also set 5 threads/page in the display option. The first page shows 5 threads as expected with links to page 1 and 2 in the pagination bar (so, the system realized there are more than 5 featured threads). However, when I click on page 2, it says "No threads have been featured yet. ".

When I tried installing the attached source code (Demo-Portal-1.0.0 Alpha.zip) instead, it worked perfectly.

I found out if I do not implement the following instruction from the tutorial, pagination works fine
XF said:
Implementing permissions & optimizations

To start, go to the Portal controller, and change this line:

->limitByPage($page, $perPage);

To:

->limitByPage($page, $perPage * 3);

Couldn't find any plausible explanation for this. And also I realized the attached source code does not have the above modification

PHP:
namespace Demo\Portal\Pub\Controller;

class Portal extends \XF\Pub\Controller\AbstractController
{
    public function actionIndex()
    {
        ...................................
        ...................................
        ...................................

        $finder = $repo->findFeaturedThreadsForPortalView()
            ->limitByPage($page, $perPage);

        ...................................
        ...................................
        ...................................

        return $this->view('Demo\Portal:View', 'demo_portal_view', $viewParams);
    }
}
 
Last edited:
Top Bottom