Jump to content

PageFinder->getQueryStartLimit() and pages with enabled "Allow Page Numbers"


gen
 Share

Recommended Posts

Hi there!

In the "PageFinder" core class there is a function "getQueryStartLimit". This is a code segment:

if(is_null($start) && ($input = $this->wire('input'))) {
   // if not specified in the selector, assume the 'start' property from the default page's pageNum
   $pageNum = $input->pageNum - 1; // make it zero based for calculation
   $start = $pageNum * $limit; 
}

In the scenario where a template is using "Allow Page Numbers" what this does is automatically set all $pages->find() start offset to page number multiplied with used limit.

I guess this is great for basic page operations, however in the situation when using $pages->find for extra searches within template one gets odd results.

This can be avoided by specifying custom start offset (zero), but this is annoying when just limiting search results.

I suggest an option "assume nothing" :) to be implemented that could be set for template (or site) scope.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...