Personally I dislike using includes this way for several reasons: 1) Eventually you will have a page that you DON'T want to have a header/footer on and will have to add kludgy code to get around it.
2) Since the includes run in the same memory space as the main page you have to "worry" about them when writing general page code (variable name contention, etc.) In general I find using a single CustomTag for this to be much more workable. This tag (I call mine "Wrapper") will, on start, load the header do whatever else you want then, on end, load the footer and do whatever else you want. In my case this tag itself calls out to Header,Footer and navigation custom tags to display. This wrapper tag wraps every displayable page in site. Something like this: <cfsilent><html><head><title>Welcome</title></head></html></cfsilent> <cfmodule Template="Wrapper.cfm" Title = "Welcome" NavSetting = "Entrance" SecSetting = "" MetaKeyWords = "" MetaDescription = ""> <h1>This is the body of the page</h1> </cfmodule> Note that the <CFSILENT> at the top is essential if you'll be using Verity - Verity picks up the page title from there even tho' the "real" <head><title> is in the Wrapper. In my case I pass "NavSetting" as a comma delimited list describing the hierarchical position of the page in the navigation scheme and the "SecSetting" as a comma delimited list of security groups able to see this page (at a gross-level) - page security is handled in Wrapper as well. "MetaKeyWords" and "MetaDescription" both populate the finished page's HTML meta information. You can add any attributes you like to maintain as much page specific flexibility as you like: CSS, navigation options (for example I have "FullWidth" and "NoHeader" options for some sites). Application.cfm and OnRequestEnd.cfm for me are then used primarily for user-information and metrics information gathering (in other words "non-interface" stuff). I'd be happy to send you some sample code if you like. Jim Davis > -----Original Message----- > From: Shannon Rhodes [mailto:[EMAIL PROTECTED] > Sent: Friday, September 19, 2003 11:45 AM > To: CF-Talk > Subject: Design Structure and cfinclude > > We all know that cfinclude is perfect for design headers and footers, but > now that I'm actually redesigning my site to take advantage of this, I'm > running into some perplexing problems. (Please don't suggest FuseBox, > that's way overkill for this site and I don't have the time for it). > > My initial thought was: set up an Application.cfm and OnRequestEnd.cfm in > each major section, which would call a header/footer for that section. I > would be able to pass a url variable to request a print-friendly version > instead, or to request no display at all (for action only templates). > Global variables would be cfparam'ed, and one page title and set of meta > tags would be defined per section. Voila, new pages can be content-only > without even a cfinclude line---everything would be called by the > section's > Application.cfm. > > As I'm getting into this, I'm finding that I don't like the loss of > page-specific flexibility. I'm told that dynamically generated meta tags > often are missed by search engines, for example, and I don't have a way to > override the standard section page title for pages that really ought to > have > their own title. I'm also stuck with defining all CSS and JS in one long > file, even if some style definitions and JS functions are only needed on > one > page, because I've made the header of my document standardized. Seems to > me > I'm adding all kinds of unnecessary download time. Plus, my "section > specific Application.cfm" idea kind of forces me to model my directories > after my site navigation, when I'd actually prefer to avoid a lot of third > level directories and keep pages logically grouped instead (after all, > navigation sometimes changes over time anyway, but who wants to move > directories around). > > I think I need a balance between letting CF templates "do it all" for me, > and the tedious work of writing in each page information that is probably > the same 80% of the time in a given section. > > Can anyone suggest a "best practices" approach to using cfinclude for > design > elements? Should I hard code in most of the head area of documents, so I > can put in page-level titles, meta tags, and page-specific styles & > JavaScript, followed by a cfinclude containing the remainder of the head > with links to the master style sheet, and any design code that will not > change, followed by another include for section-specific design images? > Any > suggestions are appreciated! > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137688 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm