Include Pages with ColdFusion

Team-Fly    

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.

graphics/efig09.gif

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.


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net