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

    it looks as if yams does not resolve weblinks. I added &useWeblinkUrl = `true` to the WF call and try to add [+wf.link+] in the rowtpl, but to no result. Ir resolves links like so:

    http://www.ixchel.nu/(yams_docr:http://www.ixchel.nu/nl/perlnl.html3)


    What am I doing wrong here?

    Thanks, Frank.
      • 22851
      • 805 Posts
      With YAMS, whether or not to resolve weblinks with Wayfinder is controlled by which YAMS templates you use. The templates in the doc folder don’t resolve weblinks. Eg:

      @FILE:assets/modules/yams/tpl/wayfinder/doc/row.tpl

      The templates in the docr folder do. Eg:

      @FILE:assets/modules/yams/tpl/wayfinder/docr/row.tpl

      So, you don’t need to use the &useWeblinkUrl parameter.
        YAMS: Yet Another Multilingual Solution for MODx
        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • 10076
        • 1,024 Posts
        Hi PM,

        Thanks, at first I tried without the addition of anything and noticed it did not resolve the correct URL.
        That s when I found out about that WF weblink [+wflink+].

        This is my call, tried with and without that wf weblink addition

        [!Wayfinder? &startId=`0` &level=`1` &useWeblinkUrl = `true` &rowTpl=`@FILE:assets/modules/yams/tpl/wayfinder/docr/row.tpl`!]</div>


        Anyway, links resolve as http://mydomain.com/ nothing else, so reverting to the startpage.
          • 22851
          • 805 Posts
          I’m pretty sure I know what’s going wrong for you... Your weblink is probably associated with a multilingual template. You are specifying the link in the standard document variable ’weblink’ field, leaving the multilingual content fields blank. Is that right?

          If your weblink is associated with a multilingual template, then it too is multilingual. That means that you have to specify the weblink (document number or web address) in each of the multilingual content fields. (Make sure that the RTE option is switched off.) The document variable weblink field is redundant in that case. This set-up means that each language can be linked to a different page if you wish.

          Alternatively, you could associate your weblink with a monolingual template and use it like you would normally. Provided you are using the docr Wayfinder templates you should get the result you expect. [+wflink+] in not required.

          Let me know if that helps.
            YAMS: Yet Another Multilingual Solution for MODx
            YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
            Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
            • 10076
            • 1,024 Posts
            Ho Pm,

            could you give me an example, cause I really have no idea what is should fill in in those fields.
            You are right, it is using a multi linguale template,

            Fr.
              • 22851
              • 805 Posts
              Ah ha...

              First make sure that the RTE setting is set to off for the document. Save it to apply the change if necessary. Then...

              If you want your weblink to point to a MODx document, then type the id of the document you want to link to into each of the multilingual content fields.

              If you want your weblink to point to an external webpage, then type the address of that webpage into each of the multilingual content fields.

              That should be it.
                YAMS: Yet Another Multilingual Solution for MODx
                YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
              • Thanks for the instructions posted here. I have followed them through, but have one issue: my English weblink is resolved, but when I switch into Turkish the weblink points to the website homepage. I have put the same document ID in the content field of both languages, turned off the RTE etc. Any suggestions for what is wrong?

                I am doing this to get round FirstChildRedirect not working, and is using 1.2.0RC3.
                  MAPLEDESIGN MODX development and MODX web design and custom development. Proud to serve UK and International clients!
                  • 12146
                  • 7 Posts
                  @PeterBowyer

                  Hi there. I was just wondering whether you’ve managed to resolve the weblink issue you described above and, if so, how?
                  I am having the exact same problem myself, have also followed PM’s instructions to the letter, but still get redirected to the home page once I change language.

                  Thanks.

                  Regards,
                  Les@ITworks
                  • Les, I didn’t get it to work, so instead I created a modified version of FirstChildRedirect. This’ll only work if your language is at the site root (e.g. http://example.com/fr/pagename.

                    YAMSFirstChildRedirect:
                    <?php
                    /*
                     * @name FirstChildRedirect
                     * @author Jason Coward <[email protected]>
                     * @modified-by Ryan Thrash <[email protected]>
                     * @license Public Domain
                     * @version 1.0
                     * 
                     * This snippet redirects to the first child document of a folder in which this
                     * snippet is included within the content (e.g. [!FirstChildRedirect!]).  This
                     * allows MODx folders to emulate the behavior of real folders since MODx
                     * usually treats folders as actual documents with their own content.
                     * 
                     * Modified to make Doc ID a required parameter... now defaults to the current 
                     * Page/Folder you call the snippet from.
                     *
                     * Modified to work with YAMS
                     * 
                     * &docid=`12` 
                     * Use the docid parameter to have this snippet redirect to the
                     * first child document of the specified document.
                     */
                    
                    $docid = (isset($docid))? $docid: $modx->documentIdentifier;
                    
                    $children= $modx->getActiveChildren($docid, 'menuindex', 'ASC');
                    if (!$children === false) {
                        $firstChild= $children[0];
                        $firstChildUrl= $modx->makeUrl($firstChild['id']);
                    } else {
                        $firstChildUrl= $modx->makeUrl($modx->config['site_start']);
                    }
                    $lang = $modx->runSnippet('CurrentLanguage');
                    return $modx->sendRedirect('/'.$lang.$firstChildUrl);
                    ?>


                    You’ll also need this snippet called CurrentLanguage:
                    <?php
                    require_once( $modx->config['base_path'] . 'assets/modules/yams/class/yams.class.inc.php' );
                    // Get an instance of the yams class
                    /* @var $yams YAMS */
                    $yams = YAMS::GetInstance();
                    if ($yams->IsMultilingualDocument($modx->documentIdentifier)) { 
                      $lang = $yams->GetCurrentLangId();
                    } else {
                        $lang = 'en';
                    }
                    return $lang;
                    ?>
                      MAPLEDESIGN MODX development and MODX web design and custom development. Proud to serve UK and International clients!
                      • 12146
                      • 7 Posts
                      Thank you Peter for sharing this.

                      I have since had a chance to re-think my approach to this particular project, and managed to do away with the need for weblinks altogether.

                      Still I’m sure your solution would come in handy one of these days wink Thanks again.


                      Regards,
                      Les@ITworks