We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22851
    • 805 Posts
    My advice would be to use the yams_data placeholder. It can be used for any tvs, not just YAMS’ standard multilingual ones. I don’t know whether GetField is clever enough to minimise the number of mysql queries... I’d guess not.
      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.
      • 25260
      • 156 Posts
      I took a little look at GetField, and it makes a query for every field you want to get, so my solution is better.

      In these days I’ll implement it with YAMS placeholder.

      Can you briefly explain how the yams parser works?

      With YAMS placeholder do I have only 1 query per page?

      Thanks,

      Roberto
        • 25260
        • 156 Posts
        I can’t use YAMS placeholders, because in my snippet I need to check the values of the TVs.

        I can call via $modx->getTemplateVarOutput() only those TVs that contains decisional data, and use YAMS placeholders for the rest; at least my queries will be shortened.

        Cheers,

        Roberto
          • 22851
          • 805 Posts
          Quote from: Roberto at Dec 17, 2009, 08:15 AM

          Can you briefly explain how the yams parser works?
          I’ve started to write some documentation on how the parser works... but that is probably too detailed for your requirements. You’ll probably find the YAMS placeholders documentation more useful for what you want.

          Quote from: Roberto at Dec 17, 2009, 08:15 AM

          With YAMS placeholder do I have only 1 query per page?
          If you use the [tt](yams_data:...)[/tt] placeholder then you will have 1 database query per 50 [tt](yams_data:...)[/tt] placeholders. You can change this value by changing the constant called [tt]YAMS_DOC_LIMIT[/tt] that’s at the top of [tt]assets/modules/yams/class/yams.class.inc.php[/tt] if you wish. The larger it is, the more data it will grab from the database in one go, and the greater the memory requirements of the computer/server you are using - so there is some sort of compromise to be struck.

          Quote from: Roberto at Dec 17, 2009, 11:23 AM

          I can’t use YAMS placeholders, because in my snippet I need to check the values of the TVs.
          I understand. I’m not sure how complicated your logic is, but if it is simple (if the placeholder output is empty then do one thing else do another for example) then you could continue to use the placeholder and use PHx for the logic. This may not be the best solution, but I thought I would mention it.

          Quote from: Roberto at Dec 17, 2009, 11:23 AM

          I can call via $modx->getTemplateVarOutput() only those TVs that contains decisional data, and use YAMS placeholders for the rest; at least my queries will be shortened.
          Good idea.
            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.