vineri, 7 august 2009

Din tainele Typo3

I am using the tt_news plugin for most of the sites. A year ago, or so, I used it for a list of churches. The client wanted the churches to be displayed in alphabetical order. Not hard to do, but then he wanted also the Romanian translation of the titles to be in displayed in alphabetical order.
In order to do that you will have to add the following line to your typo3 template
plugin.tt_news.listOrderBy = (SELECT ttn.title from tt_news as ttn WHERE tt_news.uid=ttn.t3_origuid) ASC

And if you use tt_products the line changes as follows:
plugin.tt_products.orderBy = (REPLACE(REPLACE(productslang.title,'Ţ','T'),'Ș','S'))

More to come.

2 comentarii:

Raluca spunea...

Deci ce ai vrut sa spui? Taina,taina dar fa-o cunoscuta si noua...

aphilippi spunea...

regarding the tt_news part - a slight correction....

the sql snippet used there is a subquery - inserted in the "ORDER BY" - part of the SQL query string which will be computed by the tt_news-plugin

Under certain conditions this subquery can return multiple results - which of course results in an invalid ordering condition

To avoid this the line with the typo3 declaration has to be modified this way:
plugin.tt_news.listOrderBy = (SELECT REPLACE(REPLACE(ttn.title,'Ş','S'),'Ţ','T') from tt_news as ttn WHERE tt_news.uid=ttn.t3_origuid LIMIT 0,1) ASC