[TYPO3-dev] order problem

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Fri Feb 22 10:28:24 CET 2008


Steffen Kamper schrieb:
> Hi,
> 
> i did an extension with a listview. Now i have possibility to define the 
> "order by" via flexform.
> 
> There is one option "random" that uses "order by rand()"
> 
> Now i have the problem with this order and a pagebrowser. Clicking on next 
> page the list is shuffled again because the order and it might happen that 
> some items never displayed.
> 
> I don't have an idea yet to achieve a random order and "hold" this order by 
> using pagebrowser.
> Any suggestions?

Do a select of the ids into a PHP array. Shuffle the array. Store the 
result someweher safe. Session may be ok, but remember that the user may 
open up the same page multiple times.

Change the whole list output so that is not wholly driven by the SQL select 
but by your prefetch list of ids. To display a single page read the 
required ids with "IN (...)". If you care you can display the result in the 
original order (again using the PHP array) or - adding another layour of 
"randomness" - in whatever Mysql returns the rows.

Masi




More information about the TYPO3-dev mailing list