★ wanayoo — archive 1999 http://lowendmac.net/tech/html1.htmlNouvelle recherche | Portail wanayoo

Low End MacOnline Tech JournalMac News TodayiBook PageiMac ChannelMacUSBLow End Mac GamingMacInSchoolPower Mac PageRoad ApplesMac DanielMac MetamorphosisMac MusingsMac to the FutureMiscellaneous RamblingsThings MacintoshView From the ClassroomVirtualityThe Rumor Mill


Amazon.com, your source for books, CDs, videos, and more.

.

Low End Mac's Online Tech Journal

Web Design, Part 1

Using Include Files

24 February 2000
Dan Knight

When I started designing web pages, I knew nothing about HTML. I used Claris Home Page and put things together until they looked right.

Three years later, I know very little HTML. I still use Claris Home Page. And I still design visually, trying to make things look right.

But there have been a lot of changes, large and small, during those three years. Not only did The New Low End Mac User shorten its name and broaden its focus (from just pre-Quadra desktops), but I've learned a lot of tricks that make managing the site a lot easier than it used to be.

The biggest change is invisible to the visitor. Every page on this site uses a technique called Server Side Include (SSI) to combine several files into a single page of code.

Why Use Server Side Include?

A lot of information is repeated from page to page in a site like Low End Mac. Each page has navigation links across the top and a copyright notice on the bottom. Most pages have a navigation bar on the right. Some pages include links to recent articles of interest. And recently I've begun creating "printer friendly"* versions of new articles.

* Printer friendly means different things to different people. In my case, it means the page should not run off the right side of your printer paper, the text should be black for clarity (and to save color ink if you're using a color printer), and links should be underlined (they aren't otherwise underlined using browsers that support Cascading Style Sheets, but that's a future article). On Low End Mac, the printer friendly page eliminates the navigation bar on the right and lets the text flow to whatever width your window or printed page is.

Once upon a time, the navigation links and copyright notice were hard coded into every page on the site. That meant a quick run through with BBEdit every time January rolled around to change the copyright notice. It also meant I had to open each and every page to make changes. That got to be very time consuming as the site grew.

Then I learned about SSI on the Mac Webmasters email list. Once I understood it, I quickly implemented it on my site. It's made my page files smaller and greatly reduced the number of files I have to update when changing the site.

How Server Side Include Works

A basic web page contains all the HTML used to display things properly. A page using SSI is incomplete, using external files to complete itself. For instance, every page on Low End Mac includes the following code:


<!--#include virtual="top.txt" -->

This instruction tells the server to insert the text in the file "top.txt" where the #include instruction appears. In this case, it pulls in a file that looks like this (I've shortened it significantly):


<P><A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Ftech%2Findex.shtml&y=1999">Low End Mac</A> &#149; <A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Fnews%2Findex.shtml&y=1999">Mac News Today</A> &#149; <A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Fibook%2Findex.shtml&y=1999">iBook Page</A> &#149; <A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Fimac%2Findex.shtml&y=1999">iMac Channel</A> &#149; <A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Fmacinschool%2Fview.shtml&y=1999">View From the Classroom</A> &#149; <A HREF="/old?u=http%3A%2F%2Flowendmac.net%2Frumormill%2Findex.shtml&y=1999">The Rumor Mill</A></P>

That text appears at the top of the page like this (sample links may not work):

Low End MacMac News TodayiBook PageiMac ChannelView From the ClassroomThe Rumor Mill

By having anywhere from one to several dozen pages use the same file, each individual page file is smaller. Better yet, to add a new section, I only need to update the "top.txt" file, not all the files in that directory.

The same procedure is used with the copyright notice at the bottom of the page, the right-side navigation bar, and links to recent articles.

Most recently, I've begun using SSI to create printer friendly versions of editorial content. Instead of having two pages that duplicate the same text (and two files to update when I find a typo, grammatical error, or just want to update things), both pages use the same include file, which contains the body of the article.

That's how this page is constructed -- and the beautiful thing is, because it's the server that puts all the pieces together, all you see is a single seamless page.

Although it did take quite a bit of time to update the hundreds of pages on Low End Mac to use SSI, in the long run it has saved a lot of time as I've updated the copyright notice, changed the navigation, and updated the "recent articles" links. LEM


Part 2: Site Organization

<this article available in a printer-friendly version>

Recent articles on Online Tech Journal

<back to Online Tech Journal>

.

SETI@home
Join Team Mac Observer
Online Tech Journal

Macintosh
Lisa/Macintosh XL
Compact
Mac II
Mac LC
PowerBook (68k)
Performa
500 Series
Centris/Quadra
Power Mac
PowerBook (PPC)
Maclones
Earliest Maclones
DayStar Genesis
Motorola StarMax
Power Computing
Umax SuperMac

MacResQ

Email Lists
Compact Macs
Vintage Macs
Quadlist (68040)
PowerBooks
Power Macs
SuperMacs
Mac Webmasters
more lists
Support
Low End Mac
Outpost.com
MacMall
AuctionMac
Amazon.com
MusicForce
Sponsor Us


PicoSearch

.


Macinstein Banner Exchange
Macinstein Banner Exchange

Macintosh Online Tech Journal begun 1 December 1997. This page and the entire site copyright ©1997-2000 by Dan Knight. All rights reserved.

LINK POLICY: This site allows and encourages links to any public page, so long as the linked page does not appear within a frame that prevents bookmarking the linked page.

Low End Mac is an independent publication and has not been authorized, sponsored, or otherwise approved by Apple Computer, Inc. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc. Additional company and product names may be trademarks or registered trademarks of the individual companies and are respectfully acknowledged.