We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4414
    • 63 Posts
    Hi all,

    I have been using PHx in MODx Evolution all the time. Moving to MODx Revolution I realized that there is no plugin for PHx though. You can use built-in output filters instead, but I am still missing conditional operators to realize PHx code such as the following:
    [[+phx:if=`[[*id]]`:is=`1`then:=`[[$bg_image-slider]]`:else=`[[$bg_image-default]]`]]

    Is it possible to achieve the same and other conditional statements with Revo’s built-in output filters? If not, is there a way to still use PHx in MODx Revolution?

    Thanks in advance for your help!

    Stefan

    ----

    MODx Revolution output filters: http://svn.modxcms.com/docs/display/revolution/Input+and+Output+Filters
    PHx Conditional Operators: http://wiki.modxcms.com/index.php/PHx#Conditional_operators
      • 33337
      • 3,975 Posts
      There is also IF snippet for revo which can be used for phx like stuff. Check that out.
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 4414
        • 63 Posts
        Thanks for pointing me to this snippet. However, I still can’t see how this could replace the above PHx statement. And what about conditionals with nested statements?

        I am a little bit afraid right now MODx Revolution might not provide the same degree of flexibility than MODx Evolution. Is this really the case or is there a way to get the same functionality in MODx Revolution that PHx currently provides in MODx Evolution?
          • 27708 MODX Staff
          • 2,502 Posts
          The If Snippet for conditionals will do the same thing as you’ve posted as follows:
          [[If? &subject=`[[*id]]` &operator=`equals` &operand=`1` &then=`[[$bg_image-slider]]` &else=`[[$bg_image-default]]`]]
          

          Snippets in Revo can be nested and filters can be used as well. PHx has some hard limitations as its ability for nesting and output volume. The If snippet is not necessarily a wholesale replacement but it works in most cases for such conditionals.

          If you are going to use significantly complex PHx statements it is likely that you should be writing a custom snippet as it will be likely more efficient than using the parser to do all the heavy lifting.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 27708 MODX Staff
            • 2,502 Posts
            Quote from: Bytesource at Dec 22, 2009, 02:55 AM

            I am a little bit afraid right now MODx Revolution might not provide the same degree of flexibility than MODx Evolution. Is this really the case or is there a way to get the same functionality in MODx Revolution that PHx currently provides in MODx Evolution?

            MODx Revolution has so much more flexibility than Evo it is not even possible to describe sensibly in a response. I think the problem lies in that there are new ways to do things we are used to.
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 4414
              • 63 Posts
              Thanks for the code example! The If snippet really seems to be able to replace PHx in most cases.
                • 28215
                • 4,149 Posts
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 11055 ☆ A M B ☆
                  • 3,112 Posts
                  Damn...

                  Everything is getting more complex in Revo.
                  You guys make me feel so dumb. shocked
                  Will there any Freeze Dev Time so the documentation can take the top priority?
                  Revo’s guide for a noob? tongue
                    Rico
                    Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                    MODx is great, but knowing how to use it well makes it perfect!

                    www.virtudraft.com

                    Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                    Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                    Maintainter/contributor of Babel

                    Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                    • 28215
                    • 4,149 Posts
                    Quote from: goldsky at Dec 22, 2009, 09:00 AM

                    Everything is getting more complex in Revo.
                    You guys make me feel so dumb. shocked
                    We’re just implementing what the community asked for. tongue


                    Will there any Freeze Dev Time so the documentation can take the top priority?
                    Revo’s guide for a noob? tongue
                    After RC1, documentation will become a priority.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com