You will
not see changes in the tokens/delimiters (& and `); they’re critical for making the parser work in the way we’ve chosen. Lots of people wonder why we use the funny "backtick" character instead of single-quotes. Backticks, while possibly confusing, are necessary because they’re used so infrequently in the course of "normal" typing chores. Single-quotes are used all the time (in content and in code) and would require an extra level of escaping, potentially slowing things down. Backticks are your friend, even if you don’t know it!
Even though the token delimiters will stay the same, the tag syntax is being unified and simplified. Everything is now enclosed with double-brackets ([[ ... ]]), with the character(s) immediately following the opening determining what type of "element" it is. An "element", by the way, is how to collectively refer to snippets, chunks, placeholders, plugins, templates, etc.
Content Elements
[[*TemplateVariable]]
[[$chunk]]
[[snippet]]
(Plugins and Modules still don't have tags)
Content Tags
[[+placeholder]]
[[~link]]
[[++system_setting]]
[[%language_string_key]] (new in 097)
Cache Control
Anything can be cached by simply adding a ! after the opening double-bracket:
[[!snippet]]
[[!$chunk]]
[[!*tplvar]]
Further, with 097 we get rid of using eval() in the parser altogether, allow for nested calls no matter if they’re cached or not, allow HTML inside parameters, and allow snippets to break across multiple lines. Really interesting things start to open up with this ... feeding conditional changes into the other parameters, including short html templates directly in snippet parameters instead of referencing chunks, etc. ... a whole new layer of flexibility:
[[SnippetWithWhitespace?
¶m1=`value1`
¶m2=`
<div id="nav">
<h3>Navigation — MySite</h3>
[[+wf.wrapper]]
</div>
`
¶m3=`[[AnotherCachedSnippet]]`
]]
[[!$aNonCacheableChunkWithProperties? &replaceme=`withthis` &replacethat=`[[WithThis? ¶m=`[[!++site_url]]`]]`]]
097 will also allow developers to apply PHx syntax to any element, as PHx will extend the core parser class by default. If you don’t understand that today, that’s OK, but if you have a gut feeling that that is cool, well it is! For example, you could recreate the functionality found in the member check snippet in a single call. PHx will also ultimately gain basic looping mechanisms so you can do some simple smarty-like things in your templates. (Hopefully Armand (bS) will chime in with an example soon...)
There will be new concepts introduced with the next major code release, which we expect to be final and wrapped up in the first half of the year, with a public preview coming much sooner. The UI will completely overhauled for the better and definitely much more powerful for developers—imagine dynamically loading custom menu items or rearranging things to suit your preferences. It will take some adjustment and time to reset your brain, but we think and hope it will be worth it. If not, 096 will be around and supported for a long time.
Finally, in case you’re wondering, 097 should automatically convert all your tags for you in any element when you upgrade a site to help you along.
We’re excited about getting the public preview out and revealing all that MODx is going to become. I think Packt got the award title right for sure!