[TYPO3-english] Selection order doesn't respect the pidInList parameter?

Jigal van Hemert jigal at xs4all.nl
Sun Sep 18 13:57:20 CEST 2011


Hi,

On 17-9-2011 22:02, Ernesto Domato wrote:
> Today I was using a CONTENT cObject type to get the content for
> certain pages. I made a test where the pidInList has the list of pages
> IDs in the order that I want to get the content from those pages but
> when I render those contents the order is the one of the UIDs of the
> contents and not the order of the pidInList, is that correct?, can I
> change that so it respect the pidInList order?.

It's also not the order of the uids per definition. If there is no order 
defined in a query (and no GROUP BY used) MySQL will return them in an 
undefined order.

If you use a MySQL database you could add an ORDER BY clause to your 
CONTENT object with this function:

plaap = CONTENT
plaap {
   select {
     pidInList = 123,345,321,12,23
[...]
     orderBy = FIND_IN_SET(pid, '123,345,321,12,23')
   }
}

With MySQL the function FIND_IN_SET will return the position in the list 
(second argument) where the first argument occurs.
On other database systems this function is not present or works 
differently. This solution is therefore not DBAL compatible!

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-english mailing list