A bunch of people prefer to use cfscript in their model and keep the tag based approach for the view part of the application because it fits well with HTML code (as Matt said it is a preference thing).
Jean On Thu, Dec 22, 2011 at 7:49 PM, Jeff Peters <[email protected]>wrote: > I'd suggest one thing when it comes to coding standards: be > consistent. > It doesn't matter so much whether you use CFSCRIPT in a given > situation, but you should be consistent about it. > > Two other suggestions: > 1. In SQL, I like to keep every piece of a statement on its own line, > with SQL commands on the left and the rest on the right. This makes > it easy to edit by removing pieces line-by-line, and also improves > readability. As an example, here's one of your queries: > > SELECT dns_domain, dns_subfolder > FROM tbl_dns > WHERE dns_domain = 'details.at' > AND dns_subfolder = <cfqueryparam value="#form.user_url#"> > > 2. (Not a coding style suggestion) Where you have that big collection > of ANDs to determine your error condition (near the end of step1), I'd > recommend using a structure. Call it daErrors or something ("error" > is a bad name). Each member of the struct then holds a flag, so you'd > have daErrors.type, daErrors.user_url, etc. Then you can loop over > the struct to quickly total error conditions, and if you create more > error flags, you don't have to change the loop code: > > <cfset showForm = 1> > <cfset errorTotal = 0> > <cfloop collection="#daErrors#" item="thisErr"> > <cfset errorTotal += daErrors[thisErr]> > </cfloop> > <cfif errorTotal EQ 0> > <cfset showForm = false> > </cfif> > > (You could also use bitwise operations on an integer to store these > binary flags and get REALLY efficient, but that's another discussion > altogether...) > > HTH, > - Jeff > > -- > online documentation: http://openbd.org/manual/ > google+ hints/tips: https://plus.google.com/115990347459711259462 > http://groups.google.com/group/openbd?hl=en > -- online documentation: http://openbd.org/manual/ google+ hints/tips: https://plus.google.com/115990347459711259462 http://groups.google.com/group/openbd?hl=en
