We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18399
    • 60 Posts
    Having read all the intructions I can find which don’t mention this is impossible, I’ve come to the conclusion that Phx filtering of the following format isn’t possible:

    [+phx:if=`[*tv*]`:is=`Yes`:and:if=`[*tv2*]`:is=``:then=`dosomething`:else=``+]

    I’ve got the first and the second part of the statement working on their own but together they don’t work. So I take it you can’t query two different tvs in an :and statement. I don’t believe is mentioned in the documentation, it certainly isn’t made very clear but it seems to me something you’d expect it to be able to do.

      • 16278
      • 928 Posts
      I think it’s much simpler to work out the syntax of this kind of thing by creating a PHx custom modifier, so you can just do normal PHP in a snippet:
      Create a snippet called php:yes
      <?php
      /// php:yes 
      $result = 'donothing';
      
      $testValues = explode(',',$options);
      
      if ($testValues[0] == 'Yes' && empty($testValues[1])) {
        $result = 'dosomething';
      }
      
      return $result;
      ?>

      Now you have a custom PHx modifier called "yes", which will feed the value of the placeholder to the snippet as $output, and the modifier’s string value as $options. $output is not relevant here, as you’re using the dummy phx placeholder.
      I tried this out with text TVs called testyes1 and testyes2:
      [*phx:yes=`[*testyes1*],[*testyes2*]`*]

      cool KP
        • 18399
        • 60 Posts
        Thanks, will give that a try. I was trying to avoid using more calls than necessary but this is pretty clear, and also leads to the solution to other problems. Although I’m starting to wonder if its almost better to write your own custom php / mysql queries rather than Ditto at all.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Like any other pre-built feature, it can become difficult to force it to do things that the original designers did not anticipate. One either learns to work within its limitations, modifies it to do whatever, or creates a custom application.

          I believe that the Revo developers have in mind a more modular system that will be easier to mix-and-match parts to do what you want.

          Seems like a re-hash of the UNIX philosophy of having small applications to do one thing and do it well, with the ability to chain them together for more complex functionality. I was fascinated by the /rdb UNIX shell database management system, and even at one time bought a Linux license. Their prices are too high for playing around with, though. Even so, their whitepaper is well worth reading if you’re interested in such things.

          Larry Wall originally wrote Perl because he didn’t like that idea.

          Rasmus Lerdorf didn’t like his Perl scripts for tracking access to his online resume, so he came up with his own C scripts (Personal Home Page / Forms Interpreter), which Zeev Suraski and Andi Gutmans (ZEev + ANdi = Zend) of the Technion in Haifa, Israel rewrote it (PHP 3) to form a basis for an ecommerce application. And now, MODx, built with PHP, is going back to the concept of modular rather than monolithic . It’s amusing to see the same thing happening in the MODx microcosm.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org