15
Page Layout and Navigation in ColdFusion Jon Brundage CF Developer / Accessibility and Section 508 Consultant jonwind@windcompany MDCFUG April 2003

Page Layout and Navigation in ColdFusion Jon Brundage CF Developer / Accessibility and Section 508 Consultant jonwind@windcompany MDCFUG April 2003

Embed Size (px)

Citation preview

Page Layout and Navigation in ColdFusion

Jon BrundageCF Developer / Accessibility and Section 508 Consultantjonwind@windcompany

MDCFUG April 2003

CF is power in your hands This discussion shows how to

use URL variables to create sophisticated layout and navigation.

You are only limited by your imagination.

Tags we will be using

CFINCLUDE CFSWITCH CFIF CFTRY (for error handling)

Basic Concepts Adding URL variables to links

exposes the variables for use by site pages.

We will create and use URL variables “VIEW” and “PAGE”

example: <A href=“index.cfm?

view=home”>

Some special files config.cfm nav files

Pages are created by components header left navigation (CFINCLUDE

template=“leftNav.cfm”) content area depends on URL

variable (CFINCLUDE template=“#view#.cfm”)

footer

how it works variables are set to default

values when site is entered as links are selected URL

variables are passed for use by config.cfm, leftNav.cfm and index.cfm

pages are built based on the exposed URL variable

Page layout index.cfm

HEADER

leftNav

(<cfinclude template=

“leftNav.cfm”>)

content area

(<cfinclude

template=“#view#.cfm”>)

FOOTER

config.cfm

included at top of index.cfm sets variables such as #title#,

#describe#,#breadcrumb# uses <CFSWITCH> to set

variable values depending on URL

leftNav.cfm

creates a navigation system all links have URL variables

added to HREF<a href=“index.cfm?

view=home”> leftNav uses <CFIF> to control

appearance

other uses add additional URL variables

for subfolder content “page=travel”

use URL variable in queries

error handling

• use CFTRY to prevent URL “hacking” or misspelling of URL

<cftry><cfinclude template=“#view#.cfm”> <cfcatch type="MissingInclude"> <cfset view="home"> <cfinclude template="#view#.cfm"> </cfcatch></cftry>

caution using application.cfm files

A reminder- using this system results inthe building of index.cfm in a dynamic fashion. Your pages are processed from the root folder where index.cfm resides.

Even if content is drawn from sub-folders onlythe application.cfm file in the root folder isprocessed. Any application.cfm in sub-folders ignored.

thanks!

•Have fun and be creative!

•MDCFUG a great asset-attend these meetings, get on the mailing list, visit their site (http://www.teratech.com/) and sign up for classes.

Jon Brundage

• Section 508 / web accessibility consulting•ColdFusion development•[email protected]•703-967-1024