
You’ve lost me; I wasn’t showing anything related to conditionals in this example. I was simply showing an example of the use of formatting modifiers vs. what things like PHx and other templating solutions are introducing. I think introducing all these different methods of doing these kinds of things is not in our best interest as a community or product, and I am trying to simply get us working more collaboratively as a development team on consistent, simple, and robust resolutions; not impulsive solutions that stem from a "I need this now so I’m going to hack it into the code cause it works" approach.
where I don’t actually want to output a div if that snippet isn’t going to return anything, but also I don’t want to specify the div in the snippet template because I may wish to use different variants on different layouts.
Think of it like this; everytime the parser has to handle a different set of tags or tokens, it increases the processing time of every single component being parsed. That, IMO, is even more important than the fact that conditionals would best be served if delegated to a single top-level representation via a tag; not via hierarchical markup-like tags that must have a beginning and an end. Then user interfaces can be made to properly edit embedded templates in a very user-friendly manner when dealing with conditionals. This is a problem I’ve dealt with since JSP and I just don’t see traditional conditional tags like what is being introduced in Raymond’s version of the parser, or is used in existing templating solutions like Smarty, as the answer. I think that approach to the problem has hit a dead-end.
And I fail to see how shunting stuff off to a snippet to do an IfElse is any less a chaotic mix of logic and presentation from the point of view of the user. Sure, it protects the purity of the parser, but it looks like a workaround.
A tangent?! I’m not saying no here at all; I’m offering you my vision of how to get from here to there and what I see as the primary bottleneck in that vision. And I stand firm IMO that our team members have never learned the proper way to template using MODx simply because there is no easy way to move sets of related components together.
You’ve gone off on a tangent there. It all sounds great and positive, but this masks the fact that you’re basically saying "No". You’ve redefined the problem, and then just said "With this solved..", and argued the case *for* each snippet having its own different templating system (whatever is most efficient for that component).
Importing and exporting related components is *not* the only real problem. The bigger issue is the wildly different templating formats that users must learn. Many will assume the first one they come across, be it Ditto or Wayfinder, will be the "official" way to do it. Re-use of skills - that’s useful.
So, what is the best future-proof way to achieve what bS talks about?
In way you could say that, though in an MODx analogy, the API’s represent a permalink or alias to represent some behavior, and the actual way that behavior is accomplished is delegated to whatever "page" you configure as the implementation of that behavior. In other words, I can override or replace specific behaviors in the parser by simply providing my own parser class file that overrides just the methods you want to change. No core code ever has to be changed, and you can implement those behaviors in just about anyway imaginable.
If I understand correctly what you’re saying, MODx will rely more on the API, and less on built-in features making it more flexible and closer to a framework than a traditionnal CMS.
[...] I just don’t see traditional conditional tags like what is being introduced in Raymond’s version of the parser [...] as the answer. I think that approach to the problem has hit a dead-end.Woah. Are you saying that Raymond’s parser isn’t the way forward, or that you can’t move forward from Raymond’s parser? In other words, do you see the official ultra-pure 1.0 parser including these conditional tags, or should that move to a plugin? Looking back, I see you said:
The feature of looking up data from other content, that I could understand as being an add-on, as it seemed a stretch for a parser. But the basic conditional tags... If you take them out, the parser is significantly less exciting.
This [belief that it encourages a chaotic mix of presentation and logic] is the same feeling I have about conditional tags, and beg that they be removed from this parser and implemented as simple add-ons as they should be.
).
Think of it like this; everytime the parser has to handle a different set of tags or tokens, it increases the processing time of every single component being parsed.