Macromedia® DreamWeaver® MX Unleashed By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter E. ColdFusion MX Tags and Beyond
When you use the <cfinclude> tag, the contents of a ColdFusion page can be included inside another ColdFusion page. This means that you need to write a certain task only once and include it in as many pages as you want. A common but basic use of include pages is to provide standard headers and footers for pages. Then, if the company details change or you want to update the design, the change needs to be made in only one file.
The process of inclusion is shown in Figure E.9. The <cfinclude> tag has a template attribute that specifies the file to include. The contents of this file are then inserted into the page at the point of the <cfinclude> tag. This content is treated the same as if it were in the calling page. The included content can be anything you like HTML, CFML, or JavaScript, for instance. The included page will have access to all the variables in the calling page, so code can be run within it, referring to page specific values and parameters.
Figure E.9. How ColdFusion includes pages with the <cfinclude> tag.
To include a page, insert the <cfinclude> tag from the Tag Chooser, or click the button on the CFML Basic Insert panel. The Edit Tag dialog box will prompt you to enter the template attribute. Dreamweaver enables you to browse your site to choose this.