[TYPO3-english] Cooluri: How to build two path parts out of one DB-entry

hinterindien at gmx.net hinterindien at gmx.net
Wed Mar 24 15:50:51 CET 2010


Hi, 

I am looking for a good way to produce two path-parts out of one database-entry

I got a list of hotels with, among others, names and towns, and I want to generate a link like: 

mydomain.tdl/subpage1/hotelTown/hotelName

I first of all tried it with 
<part>
      <parameter>tx_myextension[uid]</parameter>
        <lookindb>
        <to>SELECT CONCAT(hotelTown,'/',hotelName) FROM user_hotels WHERE uid=$1</to>
        <translatetoif>
          <match>^[0-9]+$</match>
        </translatetoif>
        <urlize>1</urlize>
        </lookindb>
    </part>
but this produces mydomain.tdl/subpage1/hotelTown-hotelName



Then I tried: 
<part>
      <parameter>tx_myextension[uid]</parameter>
        <lookindb>
        <to>SELECT hotelTown FROM user_hotels WHERE uid=$1</to>
        <translatetoif>
          <match>^[0-9]+$</match>
        </translatetoif>
        <urlize>1</urlize>
        </lookindb>
    </part>
<part>
      <parameter>tx_myextension[uid]</parameter>
        <lookindb>
        <to>SELECT hotelName FROM user_hotels WHERE uid=$1</to>
        <translatetoif>
          <match>^[0-9]+$</match>
        </translatetoif>
        <urlize>1</urlize>
        </lookindb>
    </part>
but this produced, strangely enough mydomain.tdl/subpage1/hotelName/hotelName

now I ended up sending the same uid twice (uid1=uid2): 
<part>
      <parameter>tx_myextension[uid1]</parameter>
        <lookindb>
        <to>SELECT hotelTown FROM user_hotels WHERE uid=$1</to>
        <translatetoif>
          <match>^[0-9]+$</match>
        </translatetoif>
        <urlize>1</urlize>
        </lookindb>
    </part>
<part>
      <parameter>tx_myextension[uid2]</parameter>
        <lookindb>
        <to>SELECT hotelName FROM user_hotels WHERE uid=$1</to>
        <translatetoif>
          <match>^[0-9]+$</match>
        </translatetoif>
        <urlize>1</urlize>
        </lookindb>
    </part>
this works fine and gives the desired mydomain.tdl/subpage1/hotelTown/hotelName

BUT!!  It's really clumsy!

Does anybody know a better solution?

Thanks a lot 
Nico


More information about the TYPO3-english mailing list