View Full Version : Using Server Side Includes
harv
03-01-2002, 08:42/08:42AM
If you need to include common information across
many pages at your site, such as a navigation bar,
what methods are available ?
I am aware of Server Side Includes.
Is Microsoft Front Page Extensions an alternative ?
With regard to SSI a few questions:
1. Is it correct that having a suffix of .shtml for the
files which call the include file is not mandatory
- i.e some hosts allow you to use .htm
2. If your host does not allow .htm is it a good idea,
if you are building a new site, to make all your
files .shtml at the start in case you later
need the include facility ?
Harvey
Advisor
03-01-2002, 09:14/09:14AM
1. Is it correct that having a suffix of .shtml for the files which call the include file is not mandatory
- i.e some hosts allow you to use .htm Harv, I don't know the answer to most of what you're asking, however, with the above, there was just a post yesterday in I-Help, or maybe it was I-Design, that discussed this and how you can do it. You needed a unix/linux server and access to your .htaccess file (I think!). I don't have the issue any more, but you can check the archives.
Jill
Spider Man
03-01-2002, 09:19/09:19AM
Correct. There is an .htaccess line to tell apache that the .htm file should be parsed like the .shtml. I can give it to you if you need it.
On the other matter, no - don't use .shtml unless you have to. Google will be more cautious indexing. Even when using ssi I use .htaccess to use a .html extension because of this. Find a host that does allow it, they're two a penny.
Otherwise, If you're not worried about the common information getting indexed, use an external javascript.
lots0cash
03-01-2002, 09:44/09:44AM
If you need to include common information across
many pages at your site, such as a navigation bar,
what methods are available ?
Have you thought about useing an external css file?
harv
03-01-2002, 10:53/10:53AM
Originally posted by lots0cash
Have you thought about useing an external css file?
Yes, indeed I have just converted over 70 pages of my
main site http://www.supertips.com to CSS !
But having common text , such as a navigation bar, is
slightly different and requires include files.
Harvey
harv
03-01-2002, 10:58/10:58AM
Originally posted by Spider Man
. There is an .htaccess line to tell apache that the .htm file should be parsed like the .shtml. I can give it to you if you need it.
Yes please Spider man.
On the other matter, no - don't use .shtml unless you have to. Google will be more cautious indexing.
What do you mean by "cautious" ?
Thanks
Harvey
Spider Man
03-01-2002, 11:06/11:06AM
AddType text/x-server-parsed-html .{ext}
replace {ext} with the extension. e.g.
AddType text/x-server-parsed-html .htm
will make apache process ssi in files ending with .htm
cautious = it will give less priority and index less files. dynamically created files are more likely to cause googlebot problems so it proceeds slower than it would with normal files. The .shtml extension makes it obvious that it is dynamic.
pageoneresults
03-01-2002, 12:05/12:05PM
In this industry that uses Front Page? Possibly! That's okay, frown down upon me if you wish. I've been using FP and SSI's since 1996 and its as easy as 1-2-3!
I use the FP SSI's on all of the sites that I build and manage. I haven't had a campaign yet where the host did not support the FP extensions. I don't use the Shared Borders, I utilize the Include Page feature which mimics the SSI command.
Here are my FP includes:
Top
http://www.123seo.com/navigation/top.htm
Left
http://www.123seo.com/navigation/left.htm
Bottom
http://www.123seo.com/navigation/footer.htm
The code that FP generates which calls the SSI's looks like this:
<!--webbot bot="Include" u-include="navigation-left.htm" tag="BODY" -->
I also have a few .asp sites that utilize a .asp include and it looks like this:
<!-- #include file="sidebar.asp" -->
I've found both of the above methods to be cross platform compatible and they provide a clean path for indexing. Remember, the spider sees what the browser does when you view the source code of the page you are looking at.
To test the spider worthiness of my sites, I utilize Brett's Search Engine Spider Simulator (http://www.searchengineworld.com/cgi-bin/sim_spider.cgi).
ihelpyou
03-01-2002, 12:10/12:10PM
Nottin wrong with using FP at all. I still do along with DW. Seems to work real well.
Good info PO!
Spider Man
03-01-2002, 12:17/12:17PM
Top stuff! I'm presuming you need frontpage extensions on the server? Don't know anything about frontpage i'm afraid.
ihelpyou
03-01-2002, 12:20/12:20PM
Yep. ya need FP ext. on the server to use FP.
harv
03-01-2002, 12:30/12:30PM
Originally posted by pageoneresults
The code that FP generates which calls the SSI's looks like this:
<!--webbot bot="Include" u-include="navigation-left.htm" tag="BODY" -->
[/B]
I am not familar with FP.
Can I achieve the SSI effect simply by putting
a similar line to the above in my page ?
Is there anything else I need to do ?
Harvey
pageoneresults
03-01-2002, 12:30/12:30PM
Per Doug's suggestion.
ihelpyou
03-01-2002, 12:32/12:32PM
It works! :)
pageoneresults
03-01-2002, 12:36/12:36PM
Since I've worked with FP from the beginning of my career, I never had to use the "real SSI's".
There is a wealth of information out there on how to set up SSI's. Here is one from Apache...
Server Side Includes (http://www.apacheweek.com/features/ssi)
Here is another from NCSA...
Server Side Includes 2 (http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html)
JuniorHarris
03-01-2002, 14:18/02:18PM
The use of server side includes should be governed by the web server software and how it is configured. Such as supporting FrontPage extensions.
Microsoft IIS 4.0 and above will actually support almost any file name for includes. I have used several ASP includes which actually use a .inc extension.
harv
03-01-2002, 16:13/04:13PM
Originally posted by pageoneresults
Per Doug's suggestion.
I am not sure if that was meant to be an answer to my question in the previous posting.
i.e you need FP ext. on the server to use FP.
Well I do have FP and I have set up a very simple
page
http://www.supertips.com/test/00.htm
which calls
http://www.supertips.com/test/01.htm
But it does not work.
Would you be able to have a look please and see why ?
Thanks
Harvey
pageoneresults
03-01-2002, 21:07/09:07PM
Hello Harv, part of the tag is missing. Your tag should look like this for the include:
<!--webbot bot="Include" u-include="01.htm" tag="BODY" startspan -->
Your current tag looks like this...
<!--webbot bot="Include" u-include="01.htm" tag="BODY" -->
You are missing the startspan section after the "BODY" element. Try correcting this and see if that solves the problem. You should also end up with this after the content for that include...
<!--webbot bot="Include" endspan i-checksum="34692" -->
The endspan is generated by the FP server extensions and is not something that you set up, its automatically included. When you view source of pages with FP includes, you'll always see an endspan to every startspan tag.
harv
04-01-2002, 05:21/05:21AM
Originally posted by pageoneresults
The endspan is generated by the FP server extensions and is not something that you set up, its automatically included.
Before I go any further:
My site supports FP extensions but do I actually need
FP in order to set up the files ?
I thought that I could simply insert the lines which FP
would generate and upload the file using normal FTP.
Harvey
pageoneresults
04-01-2002, 12:27/12:27PM
Hello Harv, I've never tried working with the extensions and not using FP to perform the editing. I cannot answer your question with any authority.
I work on all my sites live, meaning that I utilize the Edit feature in IE and have the default editor set up as FP. When I browse to one of my sites, I'll hit the edit button, get a username and password dialog an then I'm in. I make all changes real time and avoid the whole FTP issue which I did years ago.
Give it a try, it should only take a minute or so to add the correct tag and then see if the extensions will support it without using the FP interface. Let me know your results, thanks!
Advisor
04-01-2002, 12:31/12:31PM
Harv, you also may already have a version of FP on your system that you never knew about. I think it comes with windows these days. You might be able to do all this from there.
Jill
harv
04-01-2002, 12:38/12:38PM
Originally posted by pageoneresults
Give it a try, it should any take a minute or so to add the correct tag and then see if the extensions will support without using the FP interface. Let me know your results, thanks!
Yes - although I said "before I go any furrher" I did actually try it before writing to you and it did not work.
Also while trying to find out something about FP I found this statement
"Warning! If you have the FrontPage extensions installed you must never publish your site using ftp, it may damage the extensions"
Also, I don't understand the point about the endspan tag
Does it mean that the calling file contains this
<!--webbot bot="Include" u-include="01.htm" tag="BODY" startspan -->
<!--webbot bot="Include" endspan i-checksum="34692" -->
Why is the endspan line necessary ?
Harvey
pageoneresults
04-01-2002, 12:45/12:45PM
The endspan tag is generated automatically from the browser end. When a visitor hits a site built using FP and uses the extensions, it sees the include tags and then generates its own endspan tags to complete the process from the browser end.
It is not something that you need to worry about, nor will you see those endspan tags in your FP editing view. They will only appear at the Browser end when you view the source code.
P.S. Yes, FTP has been known to cause problems with the FP extensions. That is why I stopped using FTP years ago, I couldn't figure out why things were not working and then found out that you have to edit the site live through FP and save while on the server for the extensions to work properly, especially with forms. Whenever you see the [frontpage component] tag on a form while viewing in a browser, it means one of two things. Either the host is not supporting the extensions or the user did not edit using the FP interface.
Same goes for any of the other extensions. You will either see a comment in brackets [ ] or something just won't work like your includes.
harv
04-01-2002, 12:54/12:54PM
Originally posted by webwhiz
Harv, you also may already have a version of FP on your system that you never knew about. I think it comes with windows these days. You might be able to do all this from there.
Jill
Jill, you are correct.
I have Front Page Express.
I ran it and used the Insert Webbot componet/Include
and it has generated the code exactly as described.
However I am confused because it actually brings
in the code of the calling element at creation time.
I don't see how modifying the called element later
will enable it to appear in all pages which call it,
which was my understanding of the way it would work.
Harvey
pageoneresults
04-01-2002, 13:04/01:04PM
Hello Harv, the Include needs to be on each and every page that uses it. You can either use the insert > component > include page or you can click on that include you already have inserted and cut and paste throughout the site.
Where did you test the include? I tried the two links you provided and the include is still not working. I believe the first link when loaded should read 01 and it reads 00 which is the text on that first page.
P.S. I may have misunderstood your reply, sorry!
pageoneresults
04-01-2002, 13:12/01:12PM
You have multiple files that represent static parts of your site like a top, left and bottom navigation file. I usually name them top.htm, left.htm and bottom.htm.
On my template page I have tables and cells to display content. In the top cell I place my top.htm include. In the left cell I place my left.htm and same for the bottom.
I then use that template for each and every page of the site so I know there is a consistent look and feel. Once you set up the includes, there is no reason to change the coding unless you change file names, move them to another directory or create additional includes for different pages.
Whats nice about FP is when you make changes, it updates references throughout the site automatically as long as all pages are closed and not open in editing view. It may not update links in pages that are open in the editing view. It therefore eliminates the need to update each and every page where the includes are. There would be no need for you to edit the include tag if FP is used properly.
harv
04-01-2002, 15:17/03:17PM
Hi pageoneresults,
Thanks for your explanation. It is exactly how I understand
FP would work and is similar to using Includes in an
shtml file. But there is one major difference which
I don't understand.
First just to explain the little test file I have been using.
There is a page 00.htm which has one line saying
==> line from page 00
and a page 01.htm which has one line
==> line from page 01
I am trying to call (i.e include) 01 from 00
If I was using shtml I would convert 00.htm to 00.shtml
and add the line
<!--#include virtual="01.htm" -->
So the code for 00.shtml would essentially be
<body>
line from page 00
<!--#include virtual="01.htm" -->
</body>
When the browser opens this page it will display as
==> line from page 00
==> line from page 01
So I expected the FP version to look similar, i.e
<body>
line from page 00
<!--webbot bot="Include" u-include="01.htm" tag="BODY" startspan -->
</body>
But when I use FP this is what the code for 00.htm looks like
<body>
line from page 00
<!--webbot bot="Include" startspan u-include="01.htm" tag="BODY" -->
line from page 01
<!--webbot bot="Include" i-checksum="5539" endspan -->
</body>
In other words it has already added the content of page 01.htm
(it's like adding something at creation time rather than at run time).
So if I later change 01.htm what mechanism will allow
the new content to be displayed ?
Harvey
pageoneresults
04-01-2002, 15:29/03:29PM
Once your includes are in their appropriate positions on your site, you then have just the include files that would require any revisions. Let's say you have three includes; top, left and bottom. If you want to change anything in any of those three files, you would open it in FP or whatever you use to edit your sites. Make whatever changes are required and save.
The includes will already be in place and any changes you make to the top, left or bottom files will update automatically because the inlcude tag is referencing that 00.htm file.
I still may be misunderstanding your replies. The whole purpose of the includes is to make one file that can be inserted into selected pages on your site. When that one file is changed, it then updates automatically across the entire site where that include is referenced.
I'm so confused! :rolleyes:
pageoneresults
04-01-2002, 15:32/03:32PM
In other words it has already added the content of page 01.htm (it's like adding something at creation time rather than at run time).
The content of your include will appear in normal view while working in FP. If you switch to html view you will only see the include tag and not the html from the include file. The html is served to the user through the FP server extensions and the browser.
Am I catching on?
pageoneresults
04-01-2002, 15:46/03:46PM
Hey Harv, I've set up a test page just like yours and was wondering if you'd check it out. I believe it is working the way you are describing. If not, can you possibly explain a little further what the question is? Thanks!
Harv's Test (http://www.123seo.com/test/00.htm)
harv
04-01-2002, 16:08/04:08PM
Originally posted by pageoneresults
The whole purpose of the includes is to make one file that can be inserted into selected pages on your site. When that one file is changed, it then updates automatically across the entire site where that include is referenced.
I think I get it now.
Are you saying that it is during the UPLOAD process, when
that one file (01.htm in my example)is changed , that Front
Page runs through all the other files looking for references
to 01.htm and brings in the new content ?
This would be the opposite to the shtml method where
01.htm is called in at run time i.e when the
browser opens the calling files.
Harvey
Kal
06-01-2002, 02:14/02:14AM
Originally posted by pageoneresults
You have multiple files that represent static parts of your site like a top, left and bottom navigation file. I usually name them top.htm, left.htm and bottom.htm.
pageone - this is great! I use FP to edit all my sites and it is so time consuming to change every page every time I add a new link. I tried CSS and hated them. Your include solution within tables seems ideal for my situation. Thanks for the great advice :thumb:
pageoneresults
06-01-2002, 12:52/12:52PM
Hello Harv! You said...Are you saying that it is during the UPLOAD process, when that one file (01.htm in my example) is changed, that Front Page runs through all the other files looking for references to 01.htm and brings in the new content?The FP includes work the same way as the .shtml includes. The html from those includes is not rendered until the page is displayed in a browser, that is why you need the FP extensions for them to work.
Kal, I'm always happy to hear that I can share information that helps others, especially when it comes to FP. So many FP bashers out there and the only reason they bash is because they don't understand the programs capabilities and how to work around the "so called" mangling.
MazY
07-01-2002, 06:24/06:24AM
Originally posted by pageoneresults
So many FP bashers out there and the only reason they bash is because they don't understand the programs capabilities and how to work around the "so called" mangling.
Boy do I hear that one! To repeat a post made some time ago regardng FP, it is as good (or as bad) as you want it to be.
I use it and DreamWeaver. However, I much prefer FP as DreamWeaver has that God-awful non-standard interface and nothing is ever where I expect to find it.
Now, if DW would resolve the interface issues then I may rethink but I'm a Microsoft baby through and through and don't believe in reinventing the wheel. (Especially when it wasn't broken in the first place.)
vBulletin® v3.8.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.