[thelist] Cold Fusion: Style Tips?

Jeff jeff at members.evolt.org
Sun, 23 Jan 2000 03:44:20 -0800


frank,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Frank <framar@interlog.com>
:
: I think it's common to separate images, media, scripts from HTML, do
: I leave my CF files mixed with the HTML, or not?
:
: What would be logical ways of sorting them?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in most of the applications that i've been developing i don't end up having
any html documents because i use cf to build the site structure, so all
files need to be cold fusion templates to afford this.  the upside is that
when it comes time to change the look of the site i only need to edit one
file and the look is changed across the whole site.  most designs afford the
luxury of at least having includes for things like "headers", "footers",
"nav", etc.  i usually take this a step further and build a custom tag for
the whole interface that i wrap the page content with.  since a custom tag
can have both an opening tag and a closing tag that write out html, it makes
it painfully easy to pass the appropriate info to the custom tag to display
page headings specific to the calling template and set the navigation to
reflect the location within the site structure.  i pass this info as
attributes to the opening tag which i've defined in my custom tag template.

when it comes to organizing my templates, i generally have an "images"
folder for all my images, an "includes" folder for all templates that don't
get called directly by the browser but only get used in a <CFINCLUDE>, a
"custom_tags" folder for all my custom tags, a "library" folder for all my
stylesheets and external javascripts, and a "data" folder for my database
and database design documentation.  the only files that go in the root
folder are those files that get called directly by the browser for either
displaying html or processing form submissions.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Do I put my queries before the HTML starts, or do I include it in the
<html>
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

my approach with queries and other cfml code is to treat it like i would
javascript.  everything that i need to define before writing out html goes
above the doctype declaration, complete with all the logic necessary to
establish all the values and variables i'll need later on in the template.
then, as i build the html of the page, i try to keep the cfml to a minimum,
limiting myself to custom tags, <CFOUTPUT>, <CFLOOP>, and the occasional
nested <CFQUERY> as needed.

does this answer your question?  if not, or you have more questions, feel
free to reply with them.

good luck,

: jeff.howden
: web.development.professional
: evolt.org.member
:
: the.best.looking.developers.on.the.net
:
: http://evolt.org/
: jeff@members.evolt.org