On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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.
    • 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?
      • 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
        • Thanks, that works)

          How did you know that?
          • 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