We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25037
    • 32 Posts
    I’m new and I have a couple of questions about Modx tags. I generally love the cms design, but the tags seem awkward to me.

    Tag Syntax
    1) Why use a unique syntax for each tag type as opposed to a single syntax with a name qualifier? For example: {snippet:name} or {tv:name}, etc.
    2) Why use ? and & and ` with parameters? Why not seperate parameters with a space like some other cms frameworks? If regular quotes around parameter values aren’t satisfactory, maybe enforce an underscore to concatenate words. The Modx parser could remove the underscore if necessary to find a match.

    No tags for logic
    Conditionals and loops within templates/chunks don’t seem to be supported. I guess all logic could be encapsulated in the snippet (which is commendable), but doesn’t that require many more chunks? Wouldn’t I need several chunks to handle every subtle difference?

      • 27376
      • 576 Posts
      I think we’re all in agreement here wink

      Take a look at the MODx Roadmap.

      As for the ? and ` those may be removed with future version of the new parser but the 0.9.6 branch will not be changing any syntax.
        • 21257 MODX Staff
        • 730 Posts
        Quote from: rickj at Nov 26, 2007, 11:04 PM

        No tags for logic
        Conditionals and loops within templates/chunks don’t seem to be supported. I guess all logic could be encapsulated in the snippet (which is commendable), but doesn’t that require many more chunks? Wouldn’t I need several chunks to handle every subtle difference?

        You can achieve some conditionality with PHx.
        I wonder how hard it would be to make up your own loop syntax in your chunk, and pre-parse the chunk right inside the snippet?
          Mike Schell
          Lead Developer, MODX Cloud
          Email: [email protected]
          GitHub: https://github.com/netProphET/
          Twitter: @mkschell
          • 25037
          • 32 Posts
          Thank you for the responses.

          The 0.9.7 roadmap - wow. Huge, positive changes in store. The unified tag syntax is much better. With the proposed ability to override the parser, maybe I could remove the need for ?, & and `. I’m wondering about the switch to xPDO considering it’s in beta, but that’s another topic.

          Thanks for pointing me to PHx. It’s a worthy plugin. But this is a little frightening:
          [+phx:if=`[+this+]`:is=`[+that+]`:then=`do this`:else=`do that`+]
          
          I noticed in the roapmap that Smarty will be used for the new manager. For the sake of consistency, I wonder if Smarty syntax could replace the current Modx tags? That would introduce the power of conditionals/loops in templates/chunks in a simple and elegant way (like CMS Made Simple). I wonder what the disadvantages would be?

            • 25663 MODX Staff
            • 12,272 Posts
            You’ll be able to use the same smarty implementation if you’d like that will be in the initial 097 public preview release. You’ll also be able to do the similar things with the (much expanded) PHx functionality (PHx will be able to be applied to anything, and will have basic conditional loops). MODx is about giving developers freedom to do things the way they want, not forcing folks into little boxes of "the way things are done" whenever possible. Use what makes you comfortable and most productive!
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: rickj at Nov 27, 2007, 01:39 AM

              The 0.9.7 roadmap - wow. Huge, positive changes in store. The unified tag syntax is much better. With the proposed ability to override the parser, maybe I could remove the need for ?, & and `. I’m wondering about the switch to xPDO considering it’s in beta, but that’s another topic.

              Thanks for pointing me to PHx. It’s a worthy plugin. But this is a little frightening:
              [+phx:if=`[+this+]`:is=`[+that+]`:then=`do this`:else=`do that`+]
              
              I noticed in the roapmap that Smarty will be used for the new manager. For the sake of consistency, I wonder if Smarty syntax could replace the current Modx tags? That would introduce the power of conditionals/loops in templates/chunks in a simple and elegant way (like CMS Made Simple). I wonder what the disadvantages would be?

              To clarify a little, for 0.9.7, there are some siginificant parser changes, including allowing any characters in a tag as long as they are escaped between backticks, e.g. all of the following will be legal tags:
              [[Snippet? &foo=`bar=b&q?` &bar=`[[$aChunkOfHtml]]`]]
              [[!$ANonCacheableChunkWithProperties? &replaceme=`withthis` &replacethat=`[[WithThis? &param=`[[!++site_url]]`]]`]]
              [[%language_string:ucase]]
              [[!~[[!++site_start]]]]
              [[SnippetWithWhitespace?
              &param1=`value1`
              &param2=`<html ok="true">& —</html>`
              ]]
              


              Re: conditional logic: this has been a point of debate internally within the team for as long as the project has existed. My original argument against them was that mixing logic and presentation in the content templates (template, chunks, tv’s) was part of the problem with legacy CMS’s, making it difficult for people to customize parts of the output. And I still oppose conditional logic in the 0.9.7 filters (built-in phx functionality) and would rather see a set of generic snippets implement this functionality. Whatever we finally do implement, we likely will not be replacing native MODx tag syntax with Smarty.

              However, for those that prefer Smarty syntax, the combination of xPDO and Smarty brings a whole new world of possibilities, as we plan on offering the ability to create templates, chunks, TV’s and more, using Smarty syntax directly. The new object-oriented core built on xPDO makes this very powerful IMO, and I hope to attract a lot more Smarty addicts to the framework with this move. For that matter, you will be able to choose any template parser or other libraries to extend and customize MODx to do it the way you want to.

              Re: xPDO, feel free to express your concerns here or in the xPDO forums. I’ve been running production client sites with xPDO for over a year and a half now, with nothing but positive results, and have a few other developers/contributors with mission critical projects relying on it. It’s in beta because I suck at documentation and need some help fleshing it out so the project gets more attention and traction, and thus more bug reports and feature requests. wink
                • 25037
                • 32 Posts
                I’m sincerely impressed with the responsiveness of the developers and community here.