Thursday, July 5, 2007

CFIMPORT's gives customers customization control

I have read mixed reviews over CFIMPORT and I feel that I have to weigh in on the subject. I think there is another very useful application of CFImport that people are missing, and that is the ability to give customers a way to safely incorporate their web design into an existing system with a lower security risk.


First of all though, you have to understand that I am a very lazy programmer. I _hate_ coding TABLE tags for layout, not just because they are drudgery, but for all the good practices of separating User Interface (UI) from business logic (BL). So instead of a block of code like this:







<form method="post">

<table>

<tr><td>First name</td><td><input type="text" name="firstname"></td></tr>

</table>

<input type="submit">

</form>


I would prefer to write this:





<cfimport prefix="dsp" taglib="forms">


...


<dsp:beginform layout="singlecolumn" action="index.cfm" >


<dsp:input type="text" label="First Name" name="Firstname" required="Yes" size="25"/>


</dsp:beginform>




And then I have a framework of modules that handle the UI, BL, and DAL (data access layer) aspects.


In my case, (unline many of you folks that have tight control over access to your code) I have some clients that I host a Farcry CMS system for them, and they like to change things around without calling me all the time.


Aside from the obvious fact that fewer lines of code = better maintainability, I can put the code containing the <dsp:...> tags in a location the customer can access them to change the <dsp:...> tags as much as they want - as long as I prevent them from writing any CF or other script code, they can now create pages to their hearts content and I dont have to worry about them crashing or hacking my system, and they can do some fancy forms and such.


Ironicaly, I ended up witing this article in Dreamweaver and hand coding TABLE tags around my code snippets because I didnt see an easy way to highlight my code in this blogging tool.

No comments: