We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    ronaldlokers Reply #1, 14 years ago
    I try to use this code inside the outerTpl of Wayfinder:
    [!YAMS? &get=`data` &from=`pagetitle` &docid=`[[UltimateParent]]`!]


    I get this as output:
    [!YAMS? &get=`data` &from=`pagetitle` &docid=`2`!]


    How can I make YAMS working inside the outerTpl (it’s working fine outside of it)?
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 22851
      • 805 Posts
      PaulSuckling Reply #2, 14 years ago
      [[UltimateParent]] will always evaluate to the ultimate parent of the current document. However, are you looking for the ultimate parent of the menu item? If so then you’ll have to add the parameter [tt]&id=`[+wf.docid+]`[/tt]. I’m not sure why the final snippet call is not being evaluated - that requires some investigation on my part. That said, I’m pretty sure that the YAMS snippet should always be called as cacheable anyway. So, please try
      [[YAMS? &get=`data` &from=`pagetitle` &docid=`[!UltimateParent? &id=`[+wf.docid+]`!]`]]

      with or without the additional parameter as required.
        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.
        • 25483
        • 741 Posts
        ronaldlokers Reply #3, 14 years ago
        Somehow the UltimateParent snippet isn’t working, the code is working when I use this:

        [[YAMS? &get=`data` &from=`pagetitle` &docid=`7`]]


        The code is not working when I use the UltimateParent snippet and even this isn’t working:

        [[YAMS? &get=`data` &from=`pagetitle` &docid=`[+wf.docid+]`]]

          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 22851
          • 805 Posts
          PaulSuckling Reply #4, 14 years ago
          Quote from: MediaGuy at Apr 29, 2010, 01:27 PM

          ... and even this isn’t working:

          [[YAMS? &get=`data` &from=`pagetitle` &docid=`[+wf.docid+]`]]


          That surprises me. Please can you place both [tt][+wf.docid+][/tt] and [tt][[UltimateParent]][/tt] in your template on their own - not inside a YAMS snippet call, so that you can check what they evaluate to for your menu items. Then make sure that the multilingual pagetitles for those documents are not blank.

          If that doesn’t work then I’ll need to do some investigation. Please post\attach your wayfinder snippet call and any templates you are using so that I can try to reproduce the problem.

          Thanks.
            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.
            • 25483
            • 741 Posts
            ronaldlokers Reply #5, 14 years ago
            The problem is that a uncacheable snippet doesn’t work inside &outerTpl.

            The other problem is that [+wf.docid+] isn’t working, but it’s correct that it’s not working because it is the outerTpl and not a item! I can fix this by using [*id*]. So the only problem is that I don’t get output with uncacheable snippets.

            The simplest solution would be to change the YAMS snippet to allow it to get the Ultimate Parent itself (maybe by initiating the UltimateParent snippet within the YAMS snippet??)
              with regards,

              Ronald Lokers
              'Front-end developer' @ h2o Media

              • 22851
              • 805 Posts
              PaulSuckling Reply #6, 14 years ago
              Concerning [+wf.docid+], you’re right of course. It doesn’t mean anything for the outer template. It should be [*id*].

              I have done some investigation now. I find that an uncacheable snippet call, [!UltimateParent!] on its own within the outer template works. However, when used within a cacheable YAMS snippet call I don’t get any wayfinder output at all. That’s because the cacheable YAMS snippet call is getting evaluated before the uncacheable UltimateParent snippet call within the MODx evalSnippet method. That probably means that YAMS is not using the method correctly. I’ll have to do some more investigation to get to the bottom of this.

              In the meantime, yes, you could get around this by creating your own snippet based on the YAMS one located at assets\modules\yams\yams.snippet.inc.php. It will look something like this (untested):
              // Define the yams class
              require_once(  $modx->config['base_path'] . 'assets/modules/yams/class/yams.class.inc.php' );
              
              // Get an instance of the YAMS class
              $yams = YAMS::GetInstance();
              
              // Define the parameters, required by the YAMS snippet...
              $get = 'data';
              $from = 'pagetitle';
              // Run the UltimateParent snippet to get the $docid
              $docid = $modx->runSnippet( 'UltimateParent', array() );
              $beforetpl = NULL;
              $repeattpl = NULL;
              $currenttpl = NULL;
              $aftertpl = NULL;
              
              // Call the YAMS snippet to generate the multilingual output...
              return $yams->Snippet(
                $get
                , $from
                , $docid
                , $beforetpl
                , $repeattpl
                , $currenttpl
                , $aftertpl
              );
              


                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.
                • 25483
                • 741 Posts
                ronaldlokers Reply #7, 14 years ago
                thx, that modified snippet is working for me!
                  with regards,

                  Ronald Lokers
                  'Front-end developer' @ h2o Media