[TYPO3-dev] order problem

bernd wilke xoonsji02 at sneakemail.com
Fri Feb 22 14:19:32 CET 2008


on Fri, 22 Feb 2008 10:50:24 +0100, Steffen Kamper wrote:

> "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?

for every random there is a randomize. an initial-value so you can get 
the same serial of numbers. 
you may get an initializevalue (from time?) and hold it in a url-param, 
so the visitor can have always the same order.

>
>> 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

in a similar site (http://www.fewo-marken.de) I invented a shift, which 
reorders (new values in field sorting) the records each day once. Be 
careful with invisible records, or you will have a record at top for more 
than a day.

Bernd
-- 
http://www.pi-phi.de/t3v4/cheatsheet.html




More information about the TYPO3-dev mailing list