List display problem

8 posts by 3 authors in: Forums > CMS Builder
Last Post: July 10, 2008   (RSS)

By kkegans - July 8, 2008

I am generating a list using RAND() as the order by on the sorting page and using VIEWER OPTIONS set to show 10 records per page with prev & next page links.

The problem I have is that every time the PREV or NEXT links are used, the order changes in the LIST RESULTS, consequently the same item will appear on more than one page of the list. I know I probable have something screwed up, but can't see what it is. Any suggestions?



Kurt
CMSB Rocks!
Thanks,
Kurt

Re: [kkegans] List display problem

By Donna - July 8, 2008

Hi Kurt!

Well, that's actually working as intended -- random means just that: Every time the list is generated, it's going to pull in random listings, so some of those might be duplicated.

Can you let me know what the intended result is? Maybe we can come up with a different way of setting it up. :)
Donna

--
support@interactivetools.com

Re: [Donna] List display problem

By kkegans - July 8, 2008

Donna,

I would expect the list to be generated differently each time it was generated, but I would not expect the list to be regenerated every time the user moves from the first page of a partial list to the next.



If the list generated theses results: D,R,H,E,B,U,M,W,X,U,Z,Q,Y,P,C,T,X,N,I,G,O,... and you were only displaying 5 record, the PREV , Page 1 of 3 NEXT, I would expect this:

D,R,H,E,B prev - next

U,M,W,X,U prev - next

Z,Q,Y,P,C prev - next

T,X,N,I,G prev - next

NOT THIS:

D,R,H,E,B prev - next

R,M,Z,D,C prev - next

Z,D,X,T,B prev - next

Z,M,D,R,B prev - next

That does not represent PREVIOUS and NEXT, but a NEW LIST comprising a completely new random order after each PREV or NEXT is selected.

I expect the next page to be a continuation of the original list until the list end is reached, and the previous page to repeat exactly the ordered items on the preceding page.



Kurt
CMSB Rocks!
Thanks,
Kurt

Re: [kkegans] List display problem

By Dave - July 8, 2008

Hi Kurt,

The RAND() function is actually from MySQL, so we don't have any control over how it works. It's not really meant to work with prev/next pages.

To show multiple pages of random records in the same order you'd need to store the sequence information somewhere. You'd either need to update the random order at set intervals and store that or store it on a per user basis.

It can get pretty complicated pretty fast and require some custom PHP/MySQL. Another way you could do is print the entire list on one page and use javascript to only show some records and page through them. But that would require some javascript.

Sorry there's no straightforward way to do what you want. If I can think of any other solutions I'll post.
Dave Edis - Senior Developer
interactivetools.com

Re: [kkegans] List display problem

By Dave - July 8, 2008

Hi Kurt,

It's all possible, but not supported by default in CMS Builder. Can you post some links of other sites that work like this and let me know so more details about what you're trying to do? You can email me directly at dave@interactivetools.com if it's confidential.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] List display problem

By kkegans - July 8, 2008

Dave,



I dove into the source of the pages I emailed you and it looks like you were right on. They seem to be outputting the entire results list and then parsing the pages using some Java Script.......
CMSB Rocks!
Thanks,
Kurt

Re: [kkegans] List display problem

By Dave - July 10, 2008

Hi kkegans,

So it sounds like that might be a solution. I know we've been talking about this over email. If you have any other questions about this feel free to post.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com