Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

ColdFusion Tutorial – Headers and Footers

Page 2 — Headers and Footers


This whole ColdFusion thing is all about saving time while designing sites. If you’ve taken your personal time to read this far, it’s likely that you’re putting a lot of faith in the idea that I’m going to help you increase your leisure hours so you have more time to rearrange the items on your desk, play Minesweeper, and whatnot. I’ll try not to disappoint.

Back when I was designing a site for the book publisher mentioned in Day 1, I realized that with the publisher’s three already-fat databases and about 15 to 20 ColdFusion templates, I could build a site that would seem enormous to the end user fairly quickly. But being the sort that likes to minimize productive output as much as possible (to free up time for stuff like researching bad Web pages and crank-calling pay phones), I started to wonder if there wasn’t a way to take a shortcut to the shortcut, so to speak.

<CFQUERY NAME= "banner_ad" DATASOURCE= "our_stuff">
SELECT Code FROM HTML WHERE Name IS "banner_ad"
</CFQUERY>

<CFQUERY NAME= "top_nagivation_imagemap" DATASOURCE= "our_stuff">
SELECT Code FROM HTML WHERE Name IS "top_navigation_imagemap"
</CFQUERY>

<CFQUERY NAME= "bottom_nagivation_bar" DATASOURCE= "our_stuff">
SELECT code FROM html WHERE name IS "bottm_navigation_bar"
</CFQUERY>

My CFOUTPUT tags then looked like this:

<HTML>

<CFOUTPUT QUERY= "banner_ad">
#Code#
</CFOUTPUT>

<CFOUTPUT QUERY= "top_navigation_imagemap">
#Code#
</CFOUTPUT>

The actual text of the page would appear here:

<CFOUTPUT QUERY= "bottom_navigation_bar">
#Code#
</CFOUTPUT>

</HTML>

I saved that page as a read-only reference point so I wouldn’t overwrite it later if a brain freeze occurred. Then each time I created a new ColdFusion template, I started with that page and inserted whatever text or tags needed to appear in the middle. If I later decided to add a mailto link to the bottom of each page, all I had to do was add it to the HTML code in the Code field in the record named bottom_navigation_bar. Or if the company didn’t like the goofy navigation image map I created, all I had to do was change the Code field for the appropriate record in the database. Then the whole site would be updated automatically.

Rocket science it ain’t. Next, you’ll learn what to do if your page doesn’t work.

Comments