Quote from: sottwell at Nov 17, 2005, 12:45 PM
Then how could you use a placeholder as the argument for a snippet?
[[MySnippet?value=[+placeholder+]]]
Hmmm,
To get that level of flexibility I think we can code the mergePlaceholder to replace placeholders that has a value assigned to it. If no value is assigned to the placeholder then that placeholder is stored inside an array for later processing.
example #1:
[[SnippetA]]
[[SnippetB?param=[[+value]] ]]
In the above SnippetA can pass a value to SnippetB via the "value" placeholder. This is because SnippetA will be executed before SnippetB and a value of would have then been assigned to "value" placeholder.
example #2:
[[SnippetB?param=[[+value]] ]]
[[SnippetA]]
In example #2 we reverse the order of execution. In this case SnippetB will be executed before SnippetA. This means that no value will be assigned to the "value" placeholder which means that "value" will only be processed (replaced) at the end of the loop.
example #3:
[[+MyCount]]
[[CountValue]]
[[+MyCount]]
The [[CountValue]] snippet is used to increment the value of the "MyCount" placeholder. When the parser executes it will store the first "MyCount" placeholder for later processing. Next it will execute CountValue snippet which increments the "MyCount" placeholder. The next and finaly step is the process the second "MyCount" placeholder. At this time the parser will see a value for "MyCount" and replace it with the value.
At the end of the loop the parser will then replace the first "MyCount" placeholder with the value set by CountValue.
Does that make sense?