Username:
Password:
Macromedia ColdFusion Tutorials

Adhering to Standards / Design Concepts CFINCLUDE Templates

Subtitles of the Movie

So using templates, and templates in Cold Fusion parlance is different than templates in DreamWeaver parlance. In DreamWeaver a template is the same concept as Microsoft word - it's a page that is a sort of rubber stamp for all other pages that use it. For instance, if I were to make this a template, a portion of a template, this up here and then this down here and then this portion here in the middle be the content, and then make 50 pages all using this template - all 50 pages will have the code for this and this in the page. In the authoring environment, I would not be able to edit this. I couldn't go in and change the 2000 to the 2001 within each page, but I could go and open up the template itself, change that, save it and then DreamWeaver would say do you this to be perpetuated to all 50 pages that use it? Well, that was a good first step, not knocking Macromedia, it was a great first step, and it keeps everything in the developer's development environment, in the studio environment. But out on the web site, that becomes a little bit inefficient when you grow to a very large site. This right now is a small site, but it's very efficient. Because this page is actually made up of four separate documents, and let's take a look at that with the CF include statement. This is all the code for the home page that we were just looking at. I set a variable up here called page title, because I know that I am going to be using that twice, later on in some of the other templates. Cold Fusion templates are actually the CFM files; they call their pages, their documents full of Cold Fusion code templates. So first I include the page tag, I set the page title to this, and then I include a template, include top.cfm - let's go look at that. Include top.cfm has the CF output tag and then the title. If you will notice, we are within the header still. This include is the equivalent of taking this file right here and inserting it right here, so we are actually still inside the head tag when we get here. So the title is the value of 'pagetitle', and then I link to the style sheet, and then I close the head. I start the body tag and then I include menu.cfm. Let's go look at that menu.cfm. I center and hr, a table and then three links - the home page, the directory and corkboard, and I close that. I come back to include top, I start the table, and actually against my own advice a moment ago, I do put the entire page into a table, locking it in at a width of 550. And then here I have an h2 tag with page title again and now we are out of the include top file, back in our index.cfm. Looking for this, I have my image, I include bottom. Include bottom is just an hr line with today's date, my email address close the table, close the page. So if we look at this again, it's it. You'll notice that MontagueMA.net and up here MontagueMA.net is the value of this pagetitle. If I say yoohoo over here, save it, come back and reload it - yoohoo, yoohoo. The beauty of include statements and Cold Fusion code. Next, we will get into the Access database. f include statements and Cold Fusion code. Next, we will get into the Access database.

Tutorial Information

Course: Macromedia ColdFusion
Author: Mike Muller
SKU: 33287
ISBN: 1930519656
Release Date: 2001-12-19
Duration: 8 hrs / 86 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available