OK, back to it. It's been a little while, so you may want to go back and review parts 1, 2 and 3 before continuing. At this point we've created a very basic structure, giving you a basic, standards compliant document and stylesheet. But, you still don't really have any content, just a header with a bogus title, a spot for a menu, and a container for content and a sidebar. Where to next?
Well, that's part of the beauty of ColdFusion, and even web development as a whole. There is no one right way of doing things. Sure, you should try to keep your documents as standards compliant as possible, but now we are getting down to the meat of it all, dynamic documents. This is where we get in to the server side of things; variables and databases and frameworks (oh my!) The exact same thing can sometimes be done any number of ways, which is part of what I intend to show you over the next several posts to this tutorial.
First things first, how far should you go? Just how much of your document should be dynamic? Well, there are several different answers here, but I'm going to give you my opinion on it. Most of it. "Huh?" some of you are now saying. You heard me right, most of it. People come back to sites that change, and often. This is part of why blogs are so popular now, they are in continual states of flux, constantly sharing old and new thoughts and ideas.
But, I'm getting away from our primary mission here. Layout. Layouts, themselves, are generally the same. They are meant to be. Consistency of design throughout a site is almost as important as the content itself. A consistent design means that the user always knows how to navigate through the site, because they always know exactly where the navigation is. The logo for the site/company/entity is always in the same place, maintaining identity (also known as branding). If you look at some of the most popular sites on the internet over the past decade (Yahoo, Amazon, EBay, Google,...) you'll notice that their basic interfaces really haven't changed much. Sure, the gears behind the scenes have been upgraded several times, and their core functionality has been repeatedly extended, but their basic design hasn't really changed much. Why is that? Branding. That 'look' has become just as much of their identity as their logos have. People know that, when they visit one of these sites they can almost always find what they are looking for. Their designs facilitate that fluidity of movement, because they rarely change.
So we come back to our document. We take those core elements, headers, menus, sidebars, footers, and turn them in to server side includes. Pieces that can be dropped on to every dynamic document (like a ColdFusion .cfm file) within a site, so that it maintains it's consistency. This could be done as an include, a set of custom tags, a fuseaction, a piece of an 'event'. The choice of how it is implemented is up to you, the developer.
Oh, I forgot to mention something when we began today. This post doesn't have any code. I want you to flex your brain a little first. We need to place some dynamic variables within our base document. Things that will change from page to page, like the title for instance. What other elements of the base template might be candidates for dynamic variables? And what scopes might those variables reside within? Remember that we're not talking about the core content of the page, but rather the elements that make up to consistent design elements of your site. In the next lesson in this tutorial, I'll outline a few suggestions I have for this, as well as going over some of what you might share in your comments here.