View Full Version : Common headers and footers
What's considered the best way in a web design to add common headers and footers? At one time, server side includes were recommended; at another time, php. If I want to do this, but retain the existing web page names (i.e., index.htm, page1.htm, page2.htm), then what?
Ian Petersen
09-17-2005, 08:54 PM
I'd say whatever method suits your workflow. SSI is the easiest I would think if you're manually building pages one at a time and don't have need of any other kind of processing. I take it you're not using any kind of CMS?
Richard Waller
09-17-2005, 11:33 PM
The established wisdom is that you should highlight the page you are on at the moment, and not make it link to itself. So what I do is to have a template for each page set and then alter it from there. But actually I do not normally bother to cripple the same page link.
Many people like eye-candy links at the top. But I feel that you should have boring text links at the bottom in case the search engine robots decide they cannot handle the eye-candy.
<hobbyhorse> Even if the navigation is consistenty from page to page, I feel that the first words on the page, above the navigation, should be the name of the website, and a sentence with the keywords to go into the search engine reference. </hobbyhorse>
Kelvyn
09-18-2005, 01:11 AM
If I want to do this, but retain the existing web page names (i.e., index.htm, page1.htm, page2.htm), then what?
If you want to keep .html instead of .shtml (with SSI) or .php then you need to use .htaccess. to parse the pages as appropriate. There are, of course, server overheads with this, especially on a big site, so my prefered way is to use php includes and use .php for all the pages.
ktinkel
09-18-2005, 05:40 AM
<hobbyhorse> Even if the navigation is consistenty from page to page, I feel that the first words on the page, above the navigation, should be the name of the website, and a sentence with the keywords to go into the search engine reference. </hobbyhorse>You suggest an interesting question, so I will reveal more ignorance and ask: Do robots actually look at web pages? Or are they dealing with the HTML source?
If the latter, one can easily arrange elements on the visual page out of their order in the HTML, so a top menu bar need not be the first thing in the HTML file.
jrabold
09-18-2005, 07:09 AM
... common headers and footers ...
If it's not a big site, you could just repeat the content literally in each html document, and then rely on your ability to do a global search-and-replace to change it when the time comes.
jrabold
09-18-2005, 07:10 AM
If you want to keep .html instead of .shtml (with SSI) or .php then you need to use .htaccess. to parse the pages as appropriate.
What's the .htaccess syntax to force parsing?
ktinkel
09-18-2005, 07:15 AM
If it's not a big site, you could just repeat the content literally in each html document, and then rely on your ability to do a global search-and-replace to change it when the time comes.That’s what I have always done, but it is interesting to contemplate an auto-magical way — but from this thread, it would probably be overkill for small/medium sites.
Interesting discussion, though.
I'd say whatever method suits your workflow. SSI is the easiest I would think if you're manually building pages one at a time and don't have need of any other kind of processing.Doesn't that require renaming the pages as .shtm or .shmtl?
I take it you're not using any kind of CMS?Er... um... uh... CMS?
The established wisdom is that you should highlight the page you are on at the moment, and not make it link to itself. So what I do is to have a template for each page set and then alter it from there. But actually I do not normally bother to cripple the same page link.I'm using templates at the moment, Richard. But am wondering if there's an easier way to do this.
If you want to keep .html instead of .shtml (with SSI) or .php then you need to use .htaccess. to parse the pages as appropriate.How do you do that? (I'm a total neophyte with .htaccess. I'm not even sure I know what it is.)
If it's not a big site, you could just repeat the content literally in each html document, and then rely on your ability to do a global search-and-replace to change it when the time comes.That's what we're doing at the moment, John -- basically using a template. (I'm collaborating with another Davenport family member on a genealogy website.) But his idea is to use something called "shared borders" from Front Page and my idea is to stay as far away from anything Microsoft-centric as possible.
Kelvyn
09-18-2005, 07:57 AM
What's the .htaccess syntax to force parsing?
John
I use:
AddType text/html .html
AddHandler server-parsed .html
For server side includes.
Kelvyn
09-18-2005, 08:11 AM
How do you do that? (I'm a total neophyte with .htaccess. I'm not even sure I know what it is.)
For the .htaccess text see the message to John. All you do is create a text file, rename it as .htaccess file and ftp it into the root directory of your site. This does assume, of course, that your site is running under Apache.
I'm afraid that documentation on this is best found in Apache's tutorials - such as here. (http://httpd.apache.org/docs/1.3/howto/htaccess.html)
jrabold
09-18-2005, 08:13 AM
... I'm a total neophyte with .htaccess. I'm not even sure I know what it is.)
Kelvyn posted his reply to that question
AddType text/html .html
AddHandler server-parsed .html
at exactly the same time as I found it being discussed at webmasterworld.com.
If you're not exaggerating about what .htaccess is, then there's more. The underlying assumption is that your server is running Apache. Then you create a text file named .htaccess. (A file name with no name, only an extension, can be tricky to do with some software on some OSs, but it can be done.) Put that content into it. The file will contain only those two lines if there isn't already an .htaccess file there. Place it in the relevant folder on the server, being sure to upload it as ASCII, not binary.
Then your ordinary .html files can contain includes that look like
<!--#include file="filename.txt"-->
in place of the repeated content. Place the repeated content in the referred text files named filename.txt. (You could have "header.txt" and "footer.txt", for example.)
Is that clear?
I'm afraid that documentation on this is best found in Apache's tutorials - such as here. (http://httpd.apache.org/docs/1.3/howto/htaccess.html)Hmmm... one of the comments there is: "The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege." This gives me more than a little pause.
Is that clear?Very. But I am a bit concerned about the comment at the Apache site: "The second consideration is one of security. You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege."
jrabold
09-18-2005, 08:34 AM
"... You are permitting users to modify server configuration, which may result in changes over which you have no control. Carefully consider whether you want to give your users this privilege."
Yes. But unless I am mistaken the "you" in that sentence refers to the server administrator, your ISP. The "user" is you, the Web site owner. If you can implement this .htaccess change, your ISP has already decided it can handle the risk to which that sentence refers.
Having said that, modifying the server configuration in some ways can allow a hacker to do damage, and I'm not certain that this one is secure from that sort of thing. Maybe Kelvyn will comment.
Steve Rindsberg
09-18-2005, 08:49 AM
I think that's directed more at the ISP sysadmin, and in this case "users" = "the customers whose web sites are hosted on your server"
It's not directed at e.g. me, the guy who HAS one of these sites and "users" = the people who visit the site.
Kelvyn
09-18-2005, 11:12 AM
"The second consideration is one of security. You are permitting users to modify server configuration, ...."
This page url was for an old versions of Apache, but the comment still holds good for those sysadmins who are not proficient in server setup. Most good hosting companies have their servers well locked down and so may even encourage the use of .htaccess for overiding Apache of PHP configuration. With virtual servers becoming the norm these days users may well have access to Apache.conf files or php.ini - and the only damage they could inflict would be to their own site.
Don't worry about server security. If the sysadmins have got mod_rewrite turned on then then they must be sure that their setup is OK.
Ian Petersen
09-18-2005, 12:42 PM
Doesn't that require renaming the pages as .shtm or .shmtl?Not necessarily. You can configure your server to process all files for SSI even if they don't actually contain an include. Obviously, this produces a small performance hit on the server but, unless we're talking about thousands of pages or very high traffic, I doubt it would make any noticable difference.
CMSContent Management System. As discussed in a few other threads around here.
Using SSI to manage repetitive chunks of code on your site is a simple form of content management system. Put a snazzy interface on it and all the chunks in a database and you've got a CMS!
You can configure your server to process all files for SSI even if they don't actually contain an include. Obviously, this produces a small performance hit on the server but, unless we're talking about thousands of pages or very high traffic, I doubt it would make any noticable difference.Nope -- not all that much and a family history genealogy site, so high traffic it ain't. When you say I can configure the server, we buy hosting from Godaddy. I assume they'd have to do the configuring...?
I think that's directed more at the ISP sysadmin, and in this case "users" = "the customers whose web sites are hosted on your server"
It's not directed at e.g. me, the guy who HAS one of these sites and "users" = the people who visit the site.
Aha! That makes me feel better. Thanks.
The "user" is you, the Web site owner. If you can implement this .htaccess change, your ISP has already decided it can handle the risk to which that sentence refers.Gotcha. Now I have to see if my ISP does allow it.
dacoyle
09-18-2005, 06:11 PM
What's considered the best way in a web design to add common headers and footers? At one time, server side includes were recommended; at another time, php. If I want to do this, but retain the existing web page names (i.e., index.htm, page1.htm, page2.htm), then what?
Judy,
If the other methods reuiquire file names, use redirects on the old file names. But, for me, I keep it simple. At work, we have standard code and are required to use it for all headers; at home, I use Dreamweaver templates, so I can easily make updates across a site. (FYI, I just make my nav area editable if it's in the header, so I can disable the active page link.)
I'm using templates at the moment, Richard. But am wondering if there's an easier way to do this.The most straightforward way (to have your cake and eat it too) would be to use templates (offline) to create the static HTML pages for the site (which you upload). When you change a template create new static page(s).
Don't worry about server security. If the sysadmins have got mod_rewrite turned on then then they must be sure that their setup is OK.S'awright. Thanks.
At work, we have standard code and are required to use it for all headers; at home, I use Dreamweaver templatesThe hitch here is that the other person working on the site wants to use Front Page, and I ain't gonna do it no how no way.
Don't worry about server security. If the sysadmins have got mod_rewrite turned on then then they must be sure that their setup is OK.There's a large gap between "sure" and "right"...
jrabold
09-18-2005, 06:22 PM
Now I have to see if my ISP does allow it.
Why not just create a temporary subdirectory and put in it 1) a file that contains an include, 2) the included file, and 3) an .htaccess file containing the two lines quoted above? Then see if it works.
dthomsen8
09-19-2005, 07:09 AM
I'm using templates at the moment, Richard. But am wondering if there's an easier way to do this.
Ah, but what happens if the header or footer has to change?
I have footers in one of my legacy web sites, and I have been converting all the repeated code at the bottom of pages (basically, two sets of footers) into includes using PHP. This means all the pages calling for the footers are being switched to PHP extensions, formerly HTM. My main effort there was to get rid of all the <font> tags, going to CSS instead.
Having the footers in PHP files means that I can change the entire web site set of footers in one place.
I am not sure what you do with templates, should the footers change. Are we talking DW 2004 here?
dacoyle
09-19-2005, 09:11 AM
The hitch here is that the other person working on the site wants to use Front Page, and I ain't gonna do it no how no way.
Oh, easy solution then. If the other person wants to use Front Page, let 'em go solo. ;>
Why not just create a temporary subdirectory and put in it 1) a file that contains an include, 2) the included file, and 3) an .htaccess file containing the two lines quoted above? Then see if it works.I will, as soon as I get a round tuit. (I had to spend all day yesterday and all day (so far today) on major under-the-gun-pressure work assignments that have nothing (and I mean nothing) to do with anything I've ever been trained for or had experience with in my life...
Oh, easy solution then. If the other person wants to use Front Page, let 'em go solo. ;>That absolutely will be my response if he insists. I don't mind that he uses FP. But if he uses FP and plays with the FP-only-Microsoft-only folderol, then I'm outta here.
terrie
09-19-2005, 01:33 PM
Far be it from me to jump into this thread but....
I use GoLive (version 5 so I'm a bit behind) and GoLive has a "component" mechanism which I used to create a standard header and footer for my pages...if you take a look at the source code for say this page (http://tlbtlb.com/tlbimages/rj.html), you can how GoLive does it...
Not sure if this helps at all...
Terrie
Steve Rindsberg
09-19-2005, 01:34 PM
How many pages do you need to create? We have some FAQ-site software that's quite flexible and could be used as a kind of low-end, simple CMS system. It's entirely template based and can regenerate/re-upload your pages whenever you want to change the template.
The free demo version lets you create up to 25 pages or so.
It seems a fair number of folks use just the demo for small or personal sites, which is fine by me.
PC only
www.rdpslides.com and follow the links to Friday if you're interested.
I use GoLive (version 5 so I'm a bit behind) and GoLive has a "component" mechanism which I used to create a standard header and footer for my pages...if you take a look at the source code for say this page (http://tlbtlb.com/tlbimages/rj.html), you can how GoLive does it...I appreciate the suggestion... and love your artwork. Fabulous.
How many pages do you need to create? We have some FAQ-site software that's quite flexible and could be used as a kind of low-end, simple CMS system. It's entirely template based and can regenerate/re-upload your pages whenever you want to change the template.
The free demo version lets you create up to 25 pages or so.
It seems a fair number of folks use just the demo for small or personal sites, which is fine by me.
PC only
www.rdpslides.com (http://www.rdpslides.com) and follow the links to Friday if you're interested.That looks very interesting, thanks! I'm not sure we'd end up keeping to fewer than 25 pages, but I'll have my colleague take a look and see what he thinks. Appreciate the suggestion!
terrie
09-21-2005, 02:39 PM
>>jgr: I appreciate the suggestion... and love your artwork. Fabulous.
You're welcome and thank you...'-}}
Terrie
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.