[TYPO3-dev] order problem

Steffen Kamper steffen at sk-typo3.de
Fri Feb 22 10:50:24 CET 2008


"Martin Kutschker" <Martin.Kutschker at n0spam-blackbox.net> schrieb im 
Newsbeitrag 
news:mailman.1.1203672505.15361.typo3-dev at lists.netfielders.de...
> 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

Hi Masi,

thx for the suggestion.
So how to differ reading from generated ids or SQL, on first page use SQL?
Second problem could be that clients of this (list is a offer list for 
hotels) check it out and say: i was never on first page

vg  Steffen 






More information about the TYPO3-dev mailing list