contact: +977-01-5009282 | Email: info@yipl.com.np
Solving custom pager 10 only problem with views
Recently in a project we were carrying out, we faced a problem, the custom pager drupal module had a serious bug, it did not show more than 10 nodes when a view used to render the nodes. The usage of view by default made the problem worse.
Problem
At d.o the problem was described as "If you are using Drupal 6, you must currently install the 6.x-1.x-dev version of Custom Pagers, as there is a serious bug in 6.x-1.10-beta1 (when used with Views, it only shows up to 10 items, no matter what)." , here in this node.
Non Obvious Solution
The problem had a non obvious solution we discovered with trial and error. The ray of hope was "Pager Node List" array for each custom pager which took array of Node ids to show the custom pager, so the round way solution was as follows:
- Create a view that will output all node ids of a particular node type.
- Got to the custom pager setting for that particular pager.
- Execute the view in "Pager Node List" php code section of the custom pager. It will override the view execution.
- You are done, now pager will show X no. of posts not depenedent on view.
Code to Execute
Below is the code to execute in your "Pager Node List" option for the custom pager.
$display_id = 'default'; //name of the display
$nids=array();
$view = views_get_view('view_name'); //name of the view, change to your name
$view->execute_display($display_id);
foreach ($view->result as $result) {
$nids[] = $result->nid;
}
return $nids;
Do it as shown below:

Conclusion
Problems might have non obvious solutions so think out of the box :).
Comments
Post new comment
Recent blog posts
- 4th Toastmasters meeting - Friendship
- Toastmaster meet - theme: chilly mornings
- Second demo Toastmasters meet - Who Dares, Wins!!!
- First demo Toastmasters meet at YIPL
- Quick and Easy Git/Bash
- Forum on Mobile Ecosystem: Opportunities and Challenges
- YIPL completes four glorious years of operations
- Drupal 7 Release Party - Nepal
- Merry Xmas and Happy New Year 2011
- YIPL partners with CDBTU for International Conference