Introducing CCS:
Home - This is Your site
CCS Since 1983
Customer service
Customer Testimonials
Sales terms and conditions
How To Order
Orders and inquiries
Outside U.S. & Canada
FREE bonuses
Our Privacy Policy
Solving Ink Cartridge Problems

Product Links:

Epson/Canon ink cartridges

Epson printer cartridges

Free bonuses
Put your business on the web
View Product Categories
View Entire Online Catalog
New items on special
Videos - sale or trade
Digital media, Batteries, Chargers
Hands Free Cellphone adaptor - $1
DVD Rewinder
FREE Software

Freebies, info and games:

Best telephone line deal ever!
Less than $5 a month!

TWO unlimited calling phones lines for TWO years for $199!
Limited time introductory offer!

E-onlinedata Merchant accounts

Phone lines for under $5 a month!
Merchant Accounts: Important Info
What's in your drinking water?
Free program cleans your monitor
100 Cool Tools for Web sites
Encrypt Your Email ID
Burn DVDs to CDRs
Post Office in your home
The Ultimate Business
Auction Guide
Payment service ratings
your own domain & web site: $6/month
Quick Guide: Troubleshooting A PC
Sites with Great Customer Service
Don't Get Scammed - Warnings
Beyond HTML - Server Side Includes
What is ASP?
Digital camera resolution explained
Photos at Different Resolutions
Choosing A Digital Camera
Using A Digital Camera
Digital Camera Reviews
Articles, Fiction, Jokes
Humor, Games, Other Interesting Sites

Visit our other site for stories, jokes & creative expression
Food For Thought

Exchange links with us. Email


Change the background of this page

Clouds     PinkMarble     Original

+ Larger Font | - Smaller Font

Beyond HTML
 
Server Side Includes (page 2)

by Yisroel Goodman


When you use your browser to connect to Internet sites, the sites exists as pages on a server. The server sends you the html page and your browser does the work of translating the HTML code into a page you can view on your screen. But the server can do more than just send you pages. With the proper commands, the server can actually act on these pages and assemble them from different sources (including databases) BEFORE sending them to your browser. There are a number of ways to accomplish this. You can use a language like VBScript to embed code in your pages which the server will run. VBScript has some similarities to Javascript but while Javascript generally runs on the browser (the client side), VBScript runs before the page is sent to the browser (the server side). You probably know that if you bring up a web page and view the source code, you can see the HTML that the page developer wrote. Usually you also see any Javascript used. This is because the Javascript is sent to your machine where your browser executes it. You almost never see any VBScript. This is because the VBScript is run at the server and only the results of that execution are sent to you. Though VBScript is not terribly difficult to learn, the average person who just wants to set up a nice web site doesn't really have to go to all that trouble.

ASP (Active Server Pages) are pages which contain VBScript and usually some Javascript to balance the processing between the client side and the server side. On the server side, VBScript can look up information in a database and plug values into the HTML code which will be sent to the user. On the client side, Javascript can validate a form before the data is sent from the user to the server. But if you are not processing forms and dealing with databases, you don't need all this. All you really need is a command which will let you combine two or more files into one HTML page at the server side, before it is sent to the browser. This is known as a Server Side Include.

Consider this: You have a standard heading that you want to see on every page in your site. You have a standard page footer that you want on every page. You also have a menu that you want along the left column. Yes, you can create a page which contains all of these elements, then copy that page ten times, changing the content of each so you end up with ten different pages, all of which have the same header, footer and menu. But what happens if you have to change something in the header, footer or menu? You now have to change ten pages. With a server side include, you build each piece separately and then have your server pull them all together into one page before sending it to the browser.

Below is a simple example. Create a file called head2.inc (INC is a standard extension for an INClude file) and put in a sentence such as (without the quotes) "this is my standard heading information." Create a file called foot2.inc and put in a sentence such as "this is my standard footer information." Then create another file called menu2.inc and add some menu items similar to those shown below. Notice that the files end in SHTML and not HTML.

<table width="30%" border="1" align="left"><tr> <td>
<a href=pageone.shtml> First Page </a>
<a href=pagetwo.shtml> Second Page </a>
</td></tr></table>

You have now created a menu that takes up a column on the left, leaving 70% of the screen available on the right. The BORDER parameter draws a box around the menu. This is a good way to see how much space your table is taking up. You may decided to expand or reduce its size. When it is the way you want it, you might want to take the border parameter out. You might also want to set the background color of the menu to a different one than that of the content you will display on the right. Now create the content for the right side of the page.

<HTML><HEAD><TITLE>Page One</TITLE></HEAD><BODY>
<!--#include file="head2.inc" -->
<!--#include file="menu2.inc" -->
<table width="70%" align="right"><tr> <td>
This is the content I want to show on the right side of the page. This is the next sentence. This is the third sentence. THis is the fourth sentence. </td></tr></table>

&nbsp<P> &nbsp<P>

<!--#include file="foot2.inc" -->

</body></HTML>

Instead of saving the page with an HTML extension, save it as Pageone.shtml. Now when the page is loaded, the browser will first include the files head2.inc, menu2.inc and foot2.inc to the page before sending it to the browser. Note that one tricky part is getting the different elements to line up exactly where you want them. Sometimes you want to add some extra blank lines so that the footer doesn't cover the menu. A string of <P> will not give you more than one blank line. HTML often ignores the rest. &nbsp inserts a blank space. Combined with <P> it will give you a number of blank lines.