Page Layout and Navigation in ColdFusion Jon Brundage CF Developer / Accessibility and Section 508 Consultant MDCFUG April 2003
CF is power in your hands n This discussion shows how to use URL variables to create sophisticated layout and navigation. n You are only limited by your imagination.
Tags we will be using n CFINCLUDE n CFSWITCH n CFIF n CFTRY (for error handling)
Basic Concepts n Adding URL variables to links exposes the variables for use by site pages. n We will create and use URL variables “VIEW” and “PAGE” n example:
Some special files n config.cfm n nav files
Pages are created by components n header n left navigation (CFINCLUDE template=“leftNav.cfm”) n content area depends on URL variable (CFINCLUDE template=“#view#.cfm”) n footer
how it works n variables are set to default values when site is entered n as links are selected URL variables are passed for use by config.cfm, leftNav.cfm and index.cfm n 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 n included at top of index.cfm n sets variables such as #title#, #describe#, #breadcrumb# n uses to set variable values depending on URL
leftNav.cfm n creates a navigation system n all links have URL variables added to HREF n leftNav uses to control appearance
other uses n add additional URL variables for subfolder content “page=travel” n use URL variable in queries
error handling use CFTRY to prevent URL “hacking” or misspelling of URL
caution using application.cfm files A reminder- using this system results in the 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 only the application.cfm file in the root folder is processed. 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 ( and sign up for classes.
Jon Brundage Section 508 / web accessibility consulting ColdFusion development