ZRenderFrameQueryString
ZRenderer frame_pass_query Example
Suppose you were working with a web designer, who knew very little about Zope and less about DTML. They might provide you with HTML framesets full of tags like:
<frame name="main" src="browse_main" ...>
Suppose you want to pass query string (or POST) arguments to the frameset and have them passed down to each of the individual frame documents. Perhaps you just want to calculate some common values shared among the frames without using JavaScript?. You might use DTML-Let or REQUEST.set to compute the query string, and edit the frame tags into:
<frame name="main" src="browse_main&dtml-query_string;" ...> or <frame name="main" src="browse_main?&dtml-query_string;" ...>
Now suppose that you need the designer to make further changes to the HTML. The frameset will probably appear broken to them in the first case, and even in the second case they could easily destroy the DTML accidentally.
With ZRenderer implemented, they (or you) would add an attribute to all of the frame tags:
<frame name="main" src="browse_main" z-render=frame_pass_query ...>
You would write (or have written) a frame_pass_query
which appends
the value of query_string
to the src
attribute of the tag.
Something like this:
<dtml-call expr="tag.set('src', tag.src + query_string)"><dtml-var tag>
Then, unless the designer's editor is brain-dead enough to strip out attributes it doesn't recognize, you can send this HTML back and forth and have it work unmodified in both environments.
If you wanted, you could abstract the logic for computing query_string
out of the frameset HTML into frame_pass_query
and reuse it on other
framesets.