Twitter: raymondcamden


Address: Lafayette, LA, USA

ColdFusion/Spry Kit Proof of Concept

11-02-2006 4,920 views ColdFusion

So - in case folks are curious - I now have both a dishwasher and the Internet back at my house. I feel like I've returned to the modern world. (Yes, I'm spoiled.)

Last night instead of my normal useless browsing, I worked up a quick set of tags that will make it easier for folks to use Spry widgets. So for example, to create tabs (with the not yet officially released Spry Tab code), you can do this:

view plain print about
1<cf_tab id="demo0">
2
3    <cf_page title="Tab 1">
4    Orig Ganster
5    </cf_page>
6    
7    <cf_page title="Tab 2">
8    Tab 2
9    </cf_page>
10    
11</cf_tab>

Accordions are much more difficult:

view plain print about
1<cf_accordion id="demo1">
2
3    <cf_page title="Page One">
4    This is the content for the first accordion panel.
5    </cf_page>
6    
7    <cf_page title="Page Two">
8    This is the second page with some dynamic content, <cfoutput>#timeFormat(now())#</cfoutput>
9    </cf_page>
10    
11</cf_accordion>

The custom tags are smart enough to know when they have been run once in the request and will not re-include the JavaScript files more than once. Before I tell you where to download this - please note that this is very rough code. It doesn't have documentation (bah, docs are for wimps!) or proper error handling, or even strong testing. It really is just something I was playing with.

This all stemmed from a long talk I had with Charlie Arehart about CF and Spry and he will be working on this project as well. The project is being hosted - where else - at RIAForge: http://cfspry.riaforge.org

I also have some ideas for how to work with Spry datasets as well - but that is still way in the planning stages.

p.s. I said the code was a bit ugly - and it is - but check out how the custom tags are written, especially page.cfm. Notice how it checks for the parent and based on this can check to see if it properly wrapped. Custom tags are cool. Don't let them CFC folks fool ya!