Ive seen a lot of people asking this question with no good answer;
maybe there is a way to do it using Coldbox. I need to mimic the
CFHTMLHEAD tag but instead of putting content before the closing HEAD
tag, I need to put content before the closing BODY tag.
I'm wondering if there is a way to do this using Coldbox's
onRequestEnd or another approach. I would need to put the content in
dynamically (sometimes put it in, sometimes not depending on criteria,
just like CFHTMLHEAD). I just dont know what I would need to tap into
to get access to the generated content.
We use ColdBox 2.6 -- anyone have any ideas?
And yes, I know Open BlueDragon has the CFHTMLBODY tag, but that
doesnt exist in Adobe's CF.
Is it the same or different code that’s repeated?
sigh… having a case of the “Mondays” even on Tuesday…
I meant to ask if the code changes or if it’s simply repeated verbatim.
Yeah, the code can change, depending on other criteria (what site Im
on, a database flag, something). Right now Im trying the approach of
instead of calling SetLayout with the actual layout, Im calling a
custom template that includes the regular layout but does a
CFSAVECONTENT and then injects code before the closing BODY tag.
Messy, but Im struggling for options!
One way would be to simply put a variable called #rc.bodyend# or
whatever just above your body tag in your layout and then just populate
that variable with whatever you need included via your handler.
<cfparam> it to blank in the cases where you don't need anything.
Just an idea,
Computer Know How
Curt: Yes, a good idea. In our case, though, we have several hundred
different templates that get called based on specific criteria, and we
wanted to have a way to inject code (like CFHTMLHEAD) across all
You can also get more funky and run an interceptor in your layouts before the body end tag:
Then you can create interceptors that will be able to use the interceptor request buffer to add things at the end. The good thing about this, is that you can create decoupled objects that react to the preBody tag. You can stack them, organize them and grow it easily.
Luis F. Majano
Ortus Solutions, Corp
ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
IECFUG Manager: http://www.iecfug.com