New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • random_noob Reply #1, 1 month ago
    Hey All,

    EVAL binding will be deprecated when MODX 3.0 rolls out and since we are at MODX 2.7.0 my question is simple...what should I use now as the alternative to EVAL binding?
    • I believe it's being removed from core due to the associated security concerns. I'm sure someone will release an extra that adds the functionality back in.
      That being said, there should be other ways of achieving the same goal without using eval.
        I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
        Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
      • It's usually possible to replace an @eval binding with a regular text TV plus a very simple custom snippet containing the eval code.
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/MODx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • random_noob Reply #4, 1 month ago
          Quote from: BobRay at Jan 15, 2019, 10:50 PM
          It's usually possible to replace an @eval binding with a regular text TV plus a very simple custom snippet containing the eval code.
          Hey Bob, I do not quite understand your suggestion. What if I am trying to populate a listbox TV with values by using the @eval binding? Can you please clarify some more?
          • Do you mean populating the TV in the Manager for Manager users, or populating it in the front end for regular users?

            You might look at MIGX TVs.

            Also, maybe an @SELECT or @FILE TV would do the job.
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/MODx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • random_noob Reply #6, 4 weeks ago
              Quote from: BobRay at Jan 16, 2019, 08:15 PM
              Do you mean populating the TV in the Manager for Manager users, or populating it in the front end for regular users?

              You might look at MIGX TVs.

              Also, maybe an @SELECT or @FILE TV would do the job.
              Yes I meant populating the TV in the manager for manager users. This is what I'm doing with the EVAL binding.

              I have a parent resource (Departments) that has a MIGX TV which contains the departments' name within a company (IT,Accounts,HR, etc). The reason I'm using a MIGX TV is to allow the user to add/edit/remove a department as they wish.

              The child resources are the employees and I have two TVs within them. The first TV is a listbox and it uses @EVAL binding to get the department names from the parent resources (Departments). The second TV is a MIGX TV and within that MIGX TV, I'm using another @EVAL binding to populate a multi-listbox with the values from the first TV.

              I got the task done with @EVAL binding but I was wondering how I can achieve this without EVAL binding.
              • Someone who knows more about MIGX than I do might be able to help. In the meantime I don't think @EVAL in that location is all that dangerous as long as @EVAL is not used in the front end (which it wouldn't be in your case) and your core is relocated above the web root.

                The only way the @EVAL could be used for mischief is by someone who is able to log into the Manager, and in that case, they could cause plenty of trouble without the bother of messing with that TV.
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/MODx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting