We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9878
    • 31 Posts
    Hi guys,

    I’m currently working on multilanguage support for my page, but different than the existing ways, by having a second *content* area on each page by using a tv, called *content_eng*. I’ve got it working so far, and the big pro is, that editing a page in both languages is directly connected; I will post my complete way when I got it finished.

    But there is still one big problem - the menu

    I’d like to have on each page another TV called *menutitle_eng* and use that as menutitle of course - like having the page title (which is in german) for viewing the page in german, and using menutitle_eng for viewing the page in english.
    Language selection is already made by using a cookie.

    I already achieved following (modifying the old DropMenu):
    [tt]
    // if menutitle is blank fall back to pagetitle for menu link
    if ($_COOKIE[’Language’]==’en’ && isset($child[’longtitle’])) { $textOfLinks = (empty($child[’menutitle’])) ? ’longtitle’ : "$textOfLinks"; }
    else {$textOfLinks = (empty($child[’menutitle’])) ? ’pagetitle’ : "$textOfLinks"; }[/tt]
    so that longtitle is shown when cookie set to english. But that only works if longtitle is set.

    So I want to modify the Wayfinder Snippet, so that I can

    • use a custom TV instead of longtitle for english (e.g. menutitle_eng)
    • show up the pagetitle (which is german) in case the tv is empty
    but I don’t know how (especially the first point)

    thanks a lot, I appreciate your help. Greetings from Freiberg in the Erzgebirge.
    Steffen

    (still ModX 0.92 but will update tonight; server Ubuntu; PHP 5.1.2; apache 2; client Firefox/MacOSX)

    EDIT:
    got show up the pagetitle (which is german) in case the tv is empty solved
    EDIT:
    got first one also solved by adding following lines to DropMenu
    [tt] // if menutitle is blank fall back to pagetitle for menu link
    $nom=$modx->getTemplateVar(’title_eng’,’*’,$child[’id’]);
    $nom=$nom[’value’];
    if ($_COOKIE[’Language’]==’en’ && $nom!=’’){ $child[’pagetitle’] = $nom;};
    $textOfLinks = (empty($child[’menutitle’])) ? ’pagetitle’ : "$textOfLinks"; [/tt]
      www.steffen-uhlmann.de