When working on #2123315: Pager does not appear if fields use Views PHP (7.x-1.x), I realized that as of Views 7.x-3.8, the pager disappeared because it is no longer possible to get the total number of rows for a views by calling count($view->result); with View 7.x-3.7, that would return the total number of rows in the entire view; in 3.8, it returns the results for the current page.

Possibly related to that is the way PHP code is used to filter results: if you create a paged view with View 7.x-3.7, and add PHP filter, the code in the PHP filter is called even for rows _outside_ the current page, allowing the total number of rows to be recalculated.

As of Views 7.x-3.8, the PHP filter code is only called for rows in the current page, so it becomes impossible to know the total number of rows for the entire view.

Comments

unknownterritory’s picture

Priority: Normal » Major

I'm updating this issue's priority to major as it breaks one of the main functionalities of this module, rendering impossible to simultaneously use php filtering and paging the results.

seren10pity13’s picture

I agree, that's a real problem when using php to filter the view :

Let's take an exemple:
I'm having nodes that are events, having a start date and an end date. I want to show only the nodes that last longer than 7 days. Let's say that it represents 30 events on 100.
I'm using pagination to show 10 nodes by page.

Before I create the filter, I'm having 2 long events (more than 7 days), and 8 short events.

Then I'm adding a php filter to keep only the long events.
It loads the first page, then compares dates for each result, and removes all the ones that last more than 7 days.
So my view shows only 2 nodes, even if I'm having 30 of them in total...
And it also removes the pager.

fizk’s picture

Status: Active » Closed (duplicate)