I know these will execute in top-down fashion for a page, ie
[[snippet1]]
[[snippet2]]
If snippet1 has $a=2; snippet2 can access this variable.
However, is there a way to have $a=2; set in snippet2 and still access this variable in snippet1?
Basically I have a snippet responsible for rendering a search box, and a separate snippet rendering search results. I'd like to be able to pre-populate the searchbox with criteria based on search results. In order to do this, I need to have access to search results, ie snippet2 from snippet1. However, if my searchbox snippet is physically sitting before the search results snippet, I am unable to do this.
I understand I could have merged both snippets into 1, but then using MODX framework properly is defeated, might as well go back to a single PHP page. Basically design of the template determines whether snippet1 or snippet2 will be executed first, and this is a problem. This leaves the ordering of execution firmly in hands of how the template itself is ordered.
This problem could be overcome by introducing "execution ordering" variable of some kind, ie
[[snippet1 &EXEC=`2`]]
[[snippet2 &EXEC=`1`]]
Does anything like this already exist? Would anyone be able to offer alternative views or solutions on this?
[ed. note: papachumba last edited this post 14 years, 2 months ago.]