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

    I've spent some time trying to find how to get a YAMS placeholder value but got nothing.
    There is no problem to write (yams_id) in a chunk and get the value.
    But I can't get how to get this value from a snippet.

    $modx->getPlaceholder doesn't work.
      • 39535
      • 39 Posts
      It turned out, that php code: echo "(yams_id)" will return a proper value of this YAMS variable.
      That's cool, but I still don't know how to check this value in php code.

      I want to write a snippet that output the text according to current language.
      (A "More articles" phrase). How can I do that?
        • 36404
        • 307 Posts
        hi,

        quite easily, in a snippet, just start with
        $yams   = YAMS::GetInstance();
        $langId = $yams->GetCurrentLangId();

        $langId is your (yams_id);

        have swing
          réfléchir avant d'agir
          • 39535
          • 39 Posts
          Thanks, that works)

          How did you know that?
            • 36404
            • 307 Posts
            hi,

            sorry to be a bit slow to answer...
            actually, i've learnt a lot reading yams source code
            if you have a look at yams snippet you'll see it starts with
            YAMS::GetInstance();
            the first thing i needed when writing my first own multilingual snippet
            afterwards, still reading yams source code but yams class in the class folder, you will find nearly everything you may need to play with it

            have swing
              réfléchir avant d'agir