Using the new HTMLHelperProperty in MachII 1.8

I ran into a situation this week while working on a MachII project I’m doing with my brother that I’m sure many of you have encountered before. We have our view pages broken up into small chunks that we render inside a “pod-like” layout on the screen. Many of these view pages are using a one or more jQuery plugins (including cfUniform, DataTables and FancyBox) which need the main jQuery library to be included in the header to make them work correctly. We had been doing something like this in the top of each view that needed jQuery:

<cfsavecontent variable="jQueryInit">
     <script type="text/javascript" language="javascript"
<cfhtmlhead text="#jQueryInit#"></cfhtmlhead>

This worked perfectly fine for a while, right up until the point where we had two views in the same request that needed jQuery. If you put the above code in each of the view pages, then only some of your jQuery plugins work because the jQuery javascript file was getting loaded and instantiated multiple times–wiping out everything that had been configured previously.

Read More

What I’ve Learned: MVC frameworks are worth it

Most of us that have been around programming for a while have heard the arguments for separating content and layout in our applications numerous times. Likewise, most of us have nodded our heads and generally acknowledged that it’s a “good idea” or something similar. Over the last few days, it’s really hit home for me why this is such a good idea.

Two of the projects I’m working on at the moment have had complete user interface updates in the last two weeks. One is a MachII project I’m working on with my brother. The other is a ModelGlue project I’m working on with another client. In each instance, the decision was made that the template that we were using just wasn’t flexible enough to allow us to easily do what we wanted to so the decision was made to replace it. I’m not talking about a simple color scheme change–both these were radical template changes that changed overall layout containers and content containers as well as the styles for the content elements themselves.

In a traditional, “spaghetti” ColdFusion site like we all wrote back in the early days (what I like to call the “Bad Ole Days”), this would have been a nightmare to do on a site of any size. Granted, these two applications were both small- to mid-sized at the moment, but the amount of work and testing required would still have been significant.

Here’s the real kicker though. Each of these were done in less than 1 man day’s worth of effort due to the way MachII and ModelGlue separate the different parts of the process of generating the final HTML page! That’s just awesome as far as I’m concerned!

So, for those people that use the argument that MVC frameworks are more work than they’re worth except in large, enterprise-class applications, I submit that the first time you encounter this situation, you just might change your mind.

*Disclaimer: I know that there are other MVC frameworks out there for ColdFusion and they solve a lot of the same problems that MachII and ModelGlue do. I only mention these two here because they’re the ones that I worked with directly.