Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Jul 2007 at 03:02 UTC
Updated:
1 Jul 2011 at 06:26 UTC
have a view, which displays as a list in a page, with 20 nodes per page, across 3 pages. I am displaying the results in random ascending order.
Once the first page is displayed and I decide to go to the next page by selecting either page 2, next or last at the bottom I run into the issue that I get the results regenerated. So instead of getting page 2 of my original search, it seems to give me a new set of results on page 2. However I still have the ability to go back to page 1 or 3, so it realises it's still on page 2.
Is it possible to have my original search displayed throughout the 3 pages, so that nodes aren't displayed on all 3 pages potentially?
Comments
Comment #1
merlinofchaos commentedAlas, it is not possible. Combining pagination and random order simply doesn't work. Sorry about that, but there's nothing that can be done there.
Comment #2
swentel commentedHi Earl,
This is possible if you add an argument in the mysql RAND() function, it is used as the seed value, which produces a repeatable sequence of column values. see http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#funct...
So add a seed like the snippet underneath (views 2 implementation) and it works fine.
I'm currently working on a new handler, should I post a patch for views 2 core for a new handler called 'random with seed' or extend the existing one or even create a new module ? A lot of settings appear on the random field like:
- Use the same seed for every user
- Use a random seem per user
- Reset the seed - every day - every hour - never
- Define your own seed: ____
There might even be an option to not cache the page if we're serving pages to anonymous users, which would use a hook_exit I guess and currently doesn't exists in views.module. This probably justifies a new module I guess as I can imagine you don't want this hook in views 2 core.
Comment #3
swentel commentedWill become a seperate module, look out for views_random_seed in like an hour or so.
Comment #4
boreg commentedJust want to include a link to that module: http://drupal.org/project/views_random_seed