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

    I duplicate the root-content.

    I paste it in forlder "EN", and change the texts.

    Then I want to link each page in the root, to the page in that folder that on the same place (so the 7th root-resource links to the 7th resource in that folder).

    Also vice versa: for exampe the third resource in the "EN" folder, links to the third resource in the root.

    Thanks for any input !

    regards

    This question has been answered by Bruno17. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      are the resources only one level deep in the tree for each language?
      Then something like this could work

      $lang = $modx->getOption('lang',$scriptProperties,'en');
      $langparents = array('en'=>10,'de'=>20);
      
      $parent = $langparents[$lang];
      $menuindex = $modx->resource->get('menuindex');
      $link_id = $modx->resource->get('id');//link to the current resource, if other resource not found
      if ($resource = $modx->getObject('modResource',array('parent'=>$parent,'menuindex'=>$menuindex))){
          $link_id = $resource->get('id');    
      }
      
      return $modx->makeUrl($link_id);


      <a href="[[makeLangLink? &lang=`de`]]">DE</a>


      but why not translating at the same page with Lingua or migxMultiLang

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!