**********************************************************************
WESTMINSTER CITY COUNCIL
Please refer to the disclaimer beneath this message
**********************************************************************

True, I have looked at Fusebox, but at the moment I am not building a
Fusebox app, but I see your point and I should use what I know about Fusebox
and apply it to my none Fusebox code.

> ----------
> From:         Douglas Brown[SMTP:[EMAIL PROTECTED]]
> Sent:         16 July 2002 16:20
> To:   CF-Talk
> Subject:      Re: Writing efficient CFIF statements
> 
> If you are going to do that, you might think of using fusebox, which does
> a
> very good job of  seperating the application logic away from the the
> display.
> You can also use just one layout file and have it inherited by all the
> child
> directories etc...
> 
> http://www.fusebox.org
> 
> 
> 
> 
> 
> 
> Douglas Brown
> Email: [EMAIL PROTECTED]
> ----- Original Message -----
> From: "Adams, Stephen" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 16, 2002 8:13 AM
> Subject: RE: Writing efficient CFIF statements
> 
> 
> > **********************************************************************
> > WESTMINSTER CITY COUNCIL
> > Please refer to the disclaimer beneath this message
> > **********************************************************************
> >
> > Thanks Joe,
> >
> > That was what I was kind of looking for.  I am also thinking about the
> way I
> > design application.  I find that a lot of my app's are not very
> flexable. If
> > someone wants to have a new field in a form or a new page added in
> between
> > two existing pages.  I find it causes me a lot of re-writing to make
> these
> > simple changes.
> >
> > Does anyone have any tips that could help me design better code.
> >
> > Stephen
> >
> > > ----------
> > > From: Joe Bastian[SMTP:[EMAIL PROTECTED]]
> > > Sent: 16 July 2002 16:06
> > > To: CF-Talk
> > > Subject: RE: Writing efficient CFIF statements
> > >
> > > The LEAST no of "CFIF" is the route to best code/speed etc.. This is
> my
> > > theory though
> > > Using CFSCRIPT blocks, short-cut evaluation, Switch statements
> wherever
> > > possible than
> > > CFIF, arranging likely executable CFIF's/Switch first etc
> > >
> > >
> > > Would be cleaner code to seperate Application Logic from Presentation
> > > layer.
> > > eg qry_studentStatus.cfm (Query)
> > >      dsp_studentStatus.cfm(Display)
> > > Use of CFoutput's only where necessary is faster than wraping it
> around
> > > entire HTML etc.
> > >
> > > Joe
> > > Certified Advanced ColdFusion Developer
> > > [EMAIL PROTECTED]
> > >
> > > -----Original Message-----
> > > From: Adams, Stephen [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 16, 2002 5:09 AM
> > > To: CF-Talk
> > > Subject: Writing efficient CFIF statements
> > >
> > >
> > > **********************************************************************
> > > WESTMINSTER CITY COUNCIL
> > > Please refer to the disclaimer beneath this message
> > > **********************************************************************
> > >
> > > Hi,
> > >
> > > I am trying to put more structure into my CF code.  My idea is to
> separate
> > > the ColdFusion processing from the HTML structure and use CSS for the
> look
> > > of the site.  I am trying to get an idea of what is the best way to
> > > separate
> > > the CF.  I know that I could use custom tags, user defined function
> and if
> > > I
> > > was using MX, then components.  But these are for code that can across
> > > used
> > > in multiple pages.  What I am talking about is the CF for an
> individual
> > > page.
> > >
> > > What has all this to do with CFIF statements, well.  I was thinking of
> > > setting a series of flags that are checked against in my HTML.  The
> CFIF
> > > statements are there to check the value of these flags and amend the
> page
> > > depending on these flags.  So I want to be able to write good
> efficient
> > > CFIF
> > > statements so that my code is up to speed.
> > >
> > > Here's an example of what I am talking about:
> > >
> > > <!--- Default ColdFusion Parameters --->
> > > <cfparam name="QueryResults" default="" type="string">
> > >
> > > <!--- ColdFusion Processing --->
> > > <cfquery name="myQuery" datasource="myDSN">
> > >   SELECT *
> > >   FROM    myTable
> > > </cfquery>
> > >
> > > <!--- Sets flags --->
> > > <cfif myQuery.RecordCount EQ 0>
> > >   <cfset QueryResults = 1>
> > > </cfif>
> > >
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > >
> > > <html>
> > > <head>
> > > <title>Untitled</title>
> > > </head>
> > >
> > > <body>
> > >
> > >   <cfif QueryResults EQ "1">
> > >     <table cellspacing="2" cellpadding="2">
> > >       <tr>
> > >         <td class="mainFont">Results found.</td>
> > >       </tr>
> > >     </table>
> > >   <cfelse>
> > >     <table cellspacing="2" cellpadding="2">
> > >       <tr>
> > >         <td class="mainFont">No results found.</td>
> > >       </tr>
> > >     </table>
> > >   </cfif>
> > > </body>
> > > </html>
> > >
> > > This is a simple example, but it shows how I want to keep the
> processing
> > > separate at the top of the page.
> > >
> > > My question, finally, is how are CFIF statements best written if I
> want to
> > > code this way and or is there a better way of writing my CF code.
> > >
> > > Thanks.
> > >
> > >
> > > **********************************************************************
> > > Westminster City Council switchboard:
> > > +44 20 7641 6000
> > > **********************************************************************
> > > This E-Mail may contain information which is
> > > privileged, confidential and protected from
> > > disclosure.  If you are not the intended recipient
> > > of this E-mail or any part of it, please telephone
> > > Westminster City Council immediately on receipt.
> > > You should not disclose the contents to any other
> > > person or take copies.
> > > **********************************************************************
> > >
> > >
> > >
> > 
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to