![]() |
||||||||
| Home | Tech Support | Web search | Spam Filters | Web Mail | ||||
Server Side IncludesThe following documentation is based on the documentation from Apache. I think it's a little clearer. "Server-Side-Includes" (SSI, for short), allow the WWW developer to put some of the boring work of HTML on the server. They also allow for a page to be dynamically rewritten whenever someone looks at it. A simple example, that you may have noticed on some of these pages is the 'last modified' line at the bottom. That's done with the following bit of code in the page: last modified on <!--#echo var="LAST_MODIFIED" --> by bem or you can do: last modified on <!--#flastmod file="thisfile.html"--> by bem You can change the format of the times if you like, even, by using the SSI <!--#config timefmt="%Y-%B-%d" --> Your web page can also display the site name and IP number of the person looking at it. You downloaded this page from The code to generate the above two is likewise simple: <!--#echo var="REMOTE_HOST" --> If you looked at the "sample" web page and "viewed the source" on it, you may recall that in HTML, comments start with As you can see, that's really a generalization, since the above Including filesThe last modified output is useful, but it's just the beginning of what Server Side Includes can do for you. Suppose you're working on a series of web pages, and you want each one to have a "navigation bar" at the top. You really don't want to write this code several times and then have to deal with updating it in a whole slew of pages at once. That's what SSI is for. You can simply put the navigation bar portion of your page in one file, say "nav.bar", and have the web pages that need it "include" it: <!--#include file="nav.bar"> In the spot where that code is, everything from the file named "nav.bar" will be inserted. In fact, people looking at your web page will be surprised by the consistency of your page, when you're not really doing the work. Text CountersYou can have the output of a program inserted at a given spot in your page. For example, if you find the graphic version of the counters a bit gaudy for your tastes, but you still want to have counters, you could insert the following in your page: This page has been visited <!--#echo var="URL_COUNT" --> times. This would produce the following output: This page has been visited 140 times. Beware, though, some web browsers think they are smarter than you and will cache results, so it will look like the count never changes. You may need to specifically clear your cache to see the "real" count. Making It All WorkYou need to tell Apache that you want it to handle server side includes. There are two ways of doing this. Which you use is up to you: neither is better or faster or anything. The first method is to name your file with an extension of The other method is to play with what the underlying file
permissions on the file. If the "owner-execute" bit is set, Apache will
parse the file as if it were a Note the implications for counters: if you flag a page with the group-execute bit, the web page will be sent with a modification time. The next time a user comes back and requests that page (even if they use the reload button!), the page will have the same modification time. Some browsers will then display the first page instead of the newly downloaded one. If the content on your page changes often, you probably do NOT want to set the group execute flag. Changing the file permissions can be tricky. Unless you know your ftp client well, it may be best to stick to |
|
| Home | Tech Support | Web search | Spam Filters | Web Mail |
Copyright © 1997-2008 Emerald People's Utility District |
24/7 Technical Support: |