Singapore Web Hosting - Web hosting, email hosting, web design and promotion services in Singapore.

Server Side Includes (SSI) Is A Very Useful Tool For Webmasters

SingaporeWebHosting.com

Singapore Web Hosting - Web hosting, email hosting, web design and promotion services in Singapore.

Home | Linux Hosting | Windows Hosting | Email Hosting | Domain Name | Web Design | Web Promotion | Reseller | Servers

Current Special

1 Year Free Web Hosting
included in our
Web Design Service

Web Hosting SingaporeWhy Choose Singapore Web Hosting .com
With thousands of website hosting companies why choose our service? Because we care about every customer and every detail of our business. We provide Unix / Linux web hosting, Windows hosting, email hosting, dedicated servers, domain name registration, web design and promotion services. And we make sure the job is always done right.

Home
Unix Hosting
Windows Hosting
Email Hosting
Domain Name
Web Design
Web Promotion
Reseller Plan
Dedicated Server
Support
FAQ
Resources

About Us
Contact Us

 

 

Singapore Web Hosting > Support

What Can Server Side Includes (SSI) Do For You?

You may have noticed as you browse this site, that our pages end with shtml extension instead of the more familiar html or htm. This is because we use Server Side Includes (SSI for short). Used properly, SSI can help make your web site more responsive and can even help make maintaining your site a much easier task.

Simply put, SSI directives in a shtml page will call another file (which can be text file or a program) and merger (include) the result in the finished page sent to browser. In other words, SSI will include or copy files into a web page. Think of it as being sort of like a document merge in word processing.

An example will make it clearer.

Take a look at the top menu on this page. In the actual source shtml code, there's no visible text at that place. Instead, I use this line of SSI command:

<!--#include file="header.txt" -->

In the header.txt file, which is a simple unformatted text file created by Notepad, I write these html code just like in any other normal html pages:

<p align="center">
<a href="../index.shtml">Home</a> | 
<a href="../web-hosting/index.shtml">Web Hosting Plans</a> | 
<a href="../email-hosting/index.shtml">Email Hosting</a> | 

<a href="../web-design/index.shtml">Web Design</a> | 
<a href="../web-promotion/index.shtml">Web Promotion</a> | 
<a href="index.shtml">Support</a> | 
<a href="../faq/index.shtml">FAQ</a> | 
<a href="../resources/index.shtml">Resources</a></p>

When your browser requested this page, our server first parsed the shtml file, then processed the SSI directive line (called the header.txt file), merged what's in header.txt into the final page, then sent it to your browser. So, instead of seeing the SSI directive, you see a normal top menu retrieved from the header.txt

But if you "view source" of this page, you won't see the SSI directive at all since the server has processed it before sending it to you.

Now look at the menu at left side, at the bottom, even the newsletter subscription form, they're all created by SSI. The reason? It makes web site maintenance much easier.

SSI can do much more than that. Here're some examples.

Display Local Time With Server Side Includes

The ECHO directive allows you to include information from the environment in your pages. For example, date and time.

This is something that you have probably seen on quite a few pages:

This offer is going to be expired at midnight of Thursday January 24 2019 .
Order It Now!

You don't think the webmaster is updating the page everyday, do you;-)?

The following little snippet of source code is all you need to add this feature to your page: 

This offer is going to be expired at midnight of <b><!--#config timefmt="%A %B %d %Y" --> <!--#echo var="DATE_LOCAL" --></b>.

The ECHO directive DATE_LOCAL displays the local time of where your server is. The CONFIG command adjusts the time format.

Similarly, DATE_GMT will show Greenwich time.

Making A Real Back Button

Here is a cute server side includes trick, a back button that actually takes you back to where you came from.

BACK BUTTON (Remember to press forward and come back here;-)!

How did the page know where you came from. Remember, SSI can bring in server environment information and one tidbit at our disposal is HTTP_REFERER. This is the URL that brought you to this page. Here is the source code for this trick:

<A HREF="<!--#echo var="HTTP_REFERER"-->">BACK BUTTON</A>

If you came to this page directly such as from bookmark, then (none) would be the value for HTTP_REFERER.

Here are some of other values ECHO directive can use:

CONTENT_LENGTH - size of input posted from client
CONTENT_TYPE - MIME type of content
DOCUMENT_NAME - document name that was requested
DOCUMENT_URI - URL of the document
LAST_MODIFIED - document modified date
PAGE_COUNT - number of accesses to current document since server was brought on line
REMOTE_ADDR - IP address of the client
REQUEST_METHOD - HTTP method: GET OR POST
SERVER_NAME - server hostname
SERVER_SOFTWARE - name of the server software
TOTAL_HITS - total pages served by server since brought on line

You're visiting this page from IP 3.80.32.33 , right?

Execute Programs

Another great thing about server side includes is the ability to either run programs as straight system executions, or as CGI Scripts. For security reasons, only use them if you know what you're doing.

As you can see, SSI is a very useful tools for webmasters. However, sometimes you may need to take another thing into consideration - performance. When a regular HTML page is requested, the server only has to handle sending that page to the browser requesting it. With SSI, the server must first read the SHTML file, process any directives (which can be program output or files to be included in) and then deliver the assembled page to the browser.

If you are expecting thousands of hits per minute, that can be a lot of extra work for the server. On the other hand, keeping your pages trim will more than make up for the SSI performance cost in most cases.

Today, horsepower is cheap and getting cheaper. If your hosting service provider does not allow SSI because it may slowdown their server significantly, you can be sure they're not that trustworthy.

More Web Hosting, Design, Promotion Articles and Tips

Feel free to use this article in your publication or web site.
It's pre-licensed to you.
The only requirement is to include this resource box at the end of the article:

Article by Zac Hewlett at SingaporeWebHosting.com
Visit http://www.SingaporeWebHosting.com for more
web site design and promotion articles, proven online
marketing tips and techniques.

 

Web Hosting Articles and Tips

Why Do You Need A Web Site In The First Place?
What To Look For In A Web Host? 2
Why Do You Need Your Very Own Domain Name?
How To Choose A Domain Name?
What Can Server Side Includes (SSI) Do For You?
Super-charge Your Web Site With CGI Scripts 2
How Much Bandwidth Do You Need?
What's In The Mysterious Log File?
How To Use FTP?

Web Design Articles and Tips

Web Site Design Basics - From Internet Marketers Standpoint 2
Top 10 Deadly Web Site Design Mistakes 2
Easy Web Site Maintenance Using Server Side Include (SSI)
Should You Do Web Site Design In-house?
Cascading Style Sheets (CSS) Made Easy
Avoid "Lost" Traffic By Making Full Use Of Error Pages
What The Heck Is That? - All The Jargons Explained 2 3
How To Design An Effective Navigation System?
Are You Mad About Spam?
Ten Steps To Top Ranking Pages In Google 2

Web Promotion, Internet Marketing Articles and Tips

Can You Still Make Money On The Internet?
How To Rank High In Search Engines?
How To Get Listed In Yahoo? 2
The Power Of Opt-in List
How To Reach Millions Of People With Your Product For Free?
How To Get Thousands Of People Actively Promote Your Online Business? 2
The Strategy That Will Pay You Off For Years
Does Banner Ad Still Work?
One Stone, Three Birds - Newsgroup And Forum Participation
The Magic Word
How To Drive Targeted Traffic In 10 Minutes Time?

 

Singapore Web Hosting, Web Design, Web Marketing

 

Web Hosting Singapore | Web Hosting | Email Hosting | Domain Registration | Web Design | SEO | Resellers Plan | Dedicated Servers
Copyright 2001-2009 Singapore Web Hosting .com Web Services Division of Silver Media
Privacy Policy | Terms of Use | SLA | Acceptable Usage Policy | Site Map | Singapore SEO | Singapore SEO