[TYPO3-dev] new EXT:categorize to categorize everything

Malte Jansen mail at maltejansen.de
Tue Oct 21 09:37:12 CEST 2008


Hi Georg,

Georg Ringer schrieb:

> I need your help with another feature and its importance:
> Currently I get all types of records after another, so the output is:
>  * tt_news records
>    Record 1
>    Record 2
>  * tt_content records
>    Record a
>    Record b
>  ....
> 
> Should it be possible to have them sorted by other fields like crdate, 
> title? So the output would be:
>   * Record a
>   * Record 1
>   * Record 2
>   * Record b
> 

You could do something like that:

$array = array(uid => uid, sorting => crdate, label => title);
$array2 = array(uid => uid, sorting => crdate, label => name);

SELECT select_implode($array, 'table1') FROM ...
UNION
SELECT select_implode($array, 'table1') FROM ...
ORDER BY sorting

function select_implode(array $array, $table) {
	$result = array()
	foreach ($array => $label AS $column) {
		$result[] = $table.'.'.$column . ' AS ' . $label;
	}
	$result[] = '$table AS table';
}

Just for the basic idea. It's important, that you have the same 
column-count. So you have to reduce the columns.

Cheers,

Malte




More information about the TYPO3-dev mailing list