We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25037
    • 32 Posts
    What are your thoughts on output filters vs snippets? Output filters are nice in the simplest cases, but the addition of another syntax can put off new designers and make documents look more cluttered.

    // Using output modifier:
    [[+title:lcase]] 
    [[+something:notempty=`Hello[[+name]]`]]
    
    // Using snippet:
    [[lcase? &subject=`title`]]
    [[notempty? &subject=`something` &then=`Hello[[+name]]`]]
    
    // Using generic snippet:
    [[Filter? &subject=`title` &operator=`lcase`]]
    [[Filter? &subject=`something` &operator=`notempty` &parameter=`Hello [[+name]]`]]
    
      • 3749
      • 24,544 Posts
      Snippets are almost always more efficient and faster because there is no extra parsing and no condition to evaluate. The parsing of conditional filters is quite complex (especially the if/then/else and math modifiers). OTOH, that’s less important if the tags or the page are cached. The modifiers do provide snippet-like functionality for people who are less comfortable with PHP coding. They’re also more convenient to create and type and can be used to test out concepts before writing snippet code.

      As far as clients using either of them, I think I would try to avoid that, if possible.
        Did I help you? Buy me a beer
        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
        • 26016
        • 561 Posts
        I’m right smack in the middle between designer and programmer. And I think these things are great. I agree, they may be disconcerting to non-coders. But the functionality they provide is so awesome that I wouldn’t have it any other way.

        After using them with Evo, I did note that they were different in Revo, but the docs are better, and the learning curve was near zero. If someone were new to the system, it would be longer.

        I’ve tested a LOT of systems... and I don’t know of one that does it in a more effective way. (there certainly could be, of course) Wordpress? Gotta write some PHP unless it’s just a widget stuck somewhere. WP newbies complain bitterly when they find that out. Several other systems are the same as that, or weirder. Textpattern? They have their own language for various sorts of things that must be learned. On and on.

        One can also shield people from code by using it in templates, they’re less likely to play with it, break it, or even see it. Chunks could help with that, too. But I suppose that’s more for clients.
          MODx and Wordpress development
          Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4