My Little Contribution to Coldbox…
I was happy to be able to make a little contribution to Coldbox. Why? Because I’ve kind of gotten attached in my few days of messing with it.
I was using the messagebox plugin for the first time, and got it to render on the screen. All looked fine, except I noticed it created an embedded stylesheet just above the messagebox, IN the body.
It belongs in the head of course, so I tracked down the cfm that displays the box.
It’s here: /system/includes/messagebox.cfm
I fixed it by using a trick my buddy Bobby showed me a few years back. Goes a lil somethin’ like this:
<cfsavecontent variable=”injectHead”>
Some content. Static or generated by <cfoutput>
</cfsavecontent>
<cfhtmlhead text=”#injectHead#”>
When CF processes the template, it will render the page with your injectHead (call it whatever you want) variable IN the head, where it belongs. I supposed there would be problems if you’re using <cfflush> or <cflocation>. You can’t use those tags then use <cfhtmlhead>, because by the time CF encounters the tag, the page has left the building!
I emailed Luis the fix, and he let me know he committed my fix. So cool!
Here it is…
<cfsavecontent variable=”injectHead”>
<!— Style Declaration —>
<style type=”text/css”>
.cbox_messagebox{
font-size: 13px;
font-weight: bold;
}
.cbox_messagebox_info{
background: ##D1E6EF url(/coldbox/system/includes/images/cmsg.gif) no-repeat scroll .5em 50%;
border: 1px solid ##2580B2;
margin: 0.3em;
padding: 0pt 1em 0pt 3.5em;
}
.cbox_messagebox_warning{
background: ##FFF2CF url(/coldbox/system/includes/images/wmsg.gif) no-repeat scroll .5em 50%;
border: 1px solid ##2580B2;
margin: 0.3em;
padding: 0pt 1em 0pt 3.5em;
}
.cbox_messagebox_error{
background: ##FFFFE0 url(/coldbox/system/includes/images/emsg.gif) no-repeat scroll .5em 50%;
border: 1px solid ##2580B2;
margin: 0.3em;
padding: 0pt 1em 0pt 3.5em;
}
</style>
</cfsavecontent>
<cfhtmlhead text=”#injectHead#”>
I’m havin’ a CF’n good time!
No comments yet
Leave a reply