I've written a really basic RULE that allows me to insert HTML into
the <head> or footer of a CSP page:
"Caché for Windows (x86-64) 2009.1.5 (Build 901_0_11112U): Rule
example for putting HTML in <head> or foot of html documents."
<
https://gist.github.com/4062140>
Note: Non-DTI customers should remove <csr:class
super="dt.common.page.Rule" />, do ##this.RenderDTStartTag() and do
##this.RenderDTEndTag() from the RULE.
... here's an example of how it might get used:
<
https://gist.github.com/4062140#file_enque.csp>
... where:
<custom:rg:enque>...</custom:rg:enque> will append the contents of the
tag pair to the <head>, right before the closing </head> tag.
... and:
<custom:rg:enque:body>...</custom:rg:enque:body> will append the
contents of the tag pair to the <body>, right before the closing
</body> tag.
I really love this functionality of RULEs and Caché! There have been
many times where I write a chunk of HTML and insert it into a template
and need to have related JS/CSS in the <head> and/or (in the case of
javascript) the foot of the document.
My question:
In the real world, I might have several calls to <custom:rg:enque> or
<custom:rg:enque:body>... I'd LOVE to have the ability to check if
I've already inserted the contents of the current tag pair into the
<head> or <body>.
I think what I need to play with is:
"OnMatch Method"
<
http://docs.intersystems.com/cache20091/csp/docbook/DocBook.UI.Page.cls?KEY=GCSP_customtags#GCSP_C140848>
Based on some of the example RULEs I've found in %SYS, I've played
with OnMatch, but I have not had any success "tracking" what's already
been called and appended.
I can live with the tag as it stands currently (it'll still be helpful
to me, even if it does not do any checking), but it would be so much
more useful if I could, somehow, check for the existence of the
current tag pair content before appending to <head> or <body>.
It's almost like I need create a hash of each tag call, store that key
in a global array, and for each subsequent call check that array for
the existence of said hash before appending the next tag's tag pair
contents.
Does any of that make sense?
Maybe OnMatch is not what I need? I'm just looking for some tips here. :)
Please let me know if I can explain things better.
--
Micky Hulse
Web Content Editor
The Register-Guard
3500 Chad Drive
Eugene, OR 97408
Phone:
(541) 338-2621
Fax:
(541) 683-7631
Web: <
http://www.registerguard.com>