[TYPO3] Linking between languageversions of a page

typo3 at munin.lub.lu.se typo3 at munin.lub.lu.se
Mon Apr 23 09:40:18 CEST 2007


Hi,

>>> On Fri, 20 Apr 2007, "Francois" == Francois Suter wrote:

  +> So, does anyone have a suggestion on how to do it with TS? I'm short
  +> of ideas on this one... (And yes, I've read the TSref and another
  +> load of manuals and tutorial, which in this case didn't help me).

  Francois> I'm not sure about TS, but it is certainly feasible with
  Francois> extension sr_language_menu.

Ok, thanks for the suggestion.

I tried installing that one and all it's prerequisites, but couldn't
get it to work properly. As it was late friday night (or rather early saturday
morning) and I was a bit annoyed I did this instead:

  30 = COA
  30.if.isFalse.numRows {
    table = pages_language_overlay
    select {
      pidInList.data = TSFE:id
      where = sys_language_uid={$foreignLanguageID}
    }
  }
  30.10 = TEXT
  30.10 {
    value = {$lang.cur}
    outerWrap = <li id="{$lang.id}">|</li>
    typolink {
      parameter = {$missing.translation.id}
      additionalParams = &L={$foreignLanguageID}
    }
  }
  40 = COA
  40.if.isTrue.numRows {
    table = pages_language_overlay
    select {
      pidInList.data = TSFE:id
      where = sys_language_uid={$foreignLanguageID}
    }
  }
  40.10 = TEXT
  40.10 {
    value = {$lang.cur}
    outerWrap = <li id="{$lang.id}">|</li>
    typolink {
      parameter.data = page:alias // TSFE:id
      additionalParams = &L={$foreignLanguageID}
    }
  }

It can probably be shortened a bit, but basically if there is no translation
for the page it links to a not-in-menu page which says "The page you wanted
is not translated to this language, we're very, very sorry about that" or
whatever our content-people come up with. And it works for both languages, yay! :->

Of course one could choose another type of action for the case of missing
a translation, but as the correct use of numRows and if.isFalse was the tricky
part I thought I might as well share it.


Cheers,
------------------------------------------
Mattias Borell, Sysadmin/Software Engineer
Library Headoffice, Lund University



More information about the TYPO3-english mailing list