Hello,
is it possible to use a variable in a chunk directly? Right now if i have a chunk of HTML, and i want to replace one string in it, i have to write a dedicated snippet that parses the chunk and replaces the placeholder. It would be easier if i can directly replace the placeholder in the chunk by calling the chunk with a parameter from within the content?
Olaf
-
☆ A M B ☆
- 24,524 Posts
Chunks are simply small ...er, chunks of HTML and/or text that get inserted into the document’s regular content. Their purpose is to contain blocks of content that can be common across templates (such as a page footer, or the site’s masthead) so it can be edited in one place.
They don’t have any code or other processing at all. If you want a chunk with conditional output, you’ll have to have it contain a snippet or TV.
-
MODX Staff
- 12,272 Posts
In all fairness and to reiterate yet-another-cool-thing-of what’s-coming with Revolution, you can do it as follows:
[[$MyChunk? &name=`Bob`]] where it replaced [[+MyChunk.name]] in your MyChunk chunk (note the new syntax for chunks/placeholders).
(So get to testing it and give us feedback so we can get to Beta and RC sooner!)
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me