All posts by a.philippi

typo3: remove htmlspecialchars in header

If you have a content element in typo3 with a header value containing “special chars” like romanian “diacritics” the header will be rendered like sh… – because the “special chars” are transformed using the &#xxx;-syntax, after which the & is transformed into &. The result looks like: &#xxx;

To get rid of this write in the setup part of your template:
lib.stdheader.10.setCurrent.htmlSpecialChars = 0

truncate typo3 indexed search tables for multiple typo3 sites

On a shared host we have some typo3-based sites where we use indexed search.

The table index_rel grows very fast, having over 6.000.000 entries. Even a simple search takes over 30 seconds to complete.
I searched for an elegant solution with very little success.

Here is a brute force solution: a ruby-script that search for databases that have a index_rel-table, truncates the “indexed search tables” if they reach a given size. The table will be automatically refilled every time a page is accessed, even by bots….

The script truncates the “cache tables” also, the “indexed search tables” will not be rebuild if only the cache for a given page is returned by a request.

If you do not have a single user that has access to all the databases, you should configure usernames/passwords per database.

Postleitzahl für IP

Diesmal schreib ich deutsch weil dies wohl hauptsächlich deutsche Programmierer betrifft.

Wir haben relativ lange eine Möglichkeit gesucht die Postleizahl für die Seitenbesucher einer bestimmten Seite zu bestimmen. Für Deutschland haben wir nur recht halbscharige Lösungshinweise im Internet gefunden.

Darum kommt hier die elegante Variante für ruby+geokit:


#erstmal die GPS-Koordinaten für die IP bestimmen - funktioniert natürlich nicht für jede erdenkliche IP, aber doch meistens
long_lat = Geokit::Geocoders::IpGeocoder.do_geocode(ip).ll

#dann versuchen die PLZ für diese Position zu erfahren
Geokit::Geocoders::GoogleGeocoder.reverse_geocode(long_lat).zip rescue nil

th_mailformplus voodoo with allowedReferers and email_redirect

We maintain a typo3-site which is available under several domains – since it’s not our server we do not 100% understand the network/domain forwarding, etc… arhitecture there. It seems relatively voodoo to me

However we installed the th_mailformplus for a real simple form.

If called from one domain – it worked perfectly and after successfully sending the email we were forwarded to the “thank you”-page we specified(email_redirect-pageID).

If called from the other domain – the mail was not sent and instead of being redirected correctly the TEMPLATE_SUBMITTED_OK-subpart of the template was rendered. I repeat: the TEMPLATE_SUBMITTED_OK-subpart. Once again TEMPLATE_SUBMITTED_OK contains SUBMITTED_OK … subitted ok – yeah right. Pretty stupid behaviour in my opinion…

The solution was simple, add both domains to the allowedReferers. Now it’s working.