[Home]   i n s t r u c t i o n s
< back to index       Server-Side Includes
 
i n f o
   about us
   technical
   payment
   contact

s e r v i c e s
   packages
   server
   design
   sign up

s u p p o r t
   instructions
   F.A.Q.
   password

m i s c
   resellers
   offers
   free

h o m e

  Server-side includes allow you to have a common header or footer for all pages, and change it by editing one file. The web server builds the page from the fragments each time it is requested. There are also several other functions of server-parsed html.

To make your html file be treated as shtml, rename it to filename.shtml. You can now put commands into your html to perform specific functions.

Insert an html fragment
<!--#include virtual="footer.html" -->
This will insert the contents of footer.html in place of the command.

Run a CGI script
<!--#include virtual="/cgi-bin/textcounter.cgi" -->
This inserts the output of the CGI script where the command is.
Do not use the "exec cgi" command to run cgi, it is outdated and discontinued.

Show the date
<!--#config timefmt="%B %e, %Y" --><!--#echo var="DATE_LOCAL" -->
These two commands work together. The first configures the time format, and the second actually displays the date. Many time configuration options are available, see the Solaris strftime manual page for the full listing (when logged in with telnet or ssh, type "man strftime").

Advanced functions There is still much more you can do. Please see the Apache documentation on includes for a full list of commands.

One example to detect the browser version:

 
<!--#if expr="$HTTP_USER_AGENT = /MSIE/" --> 
you are using microsoft internet explorer 
 <!--#if expr="$HTTP_USER_AGENT = '/MSIE 3/'" --> 
 version 3 
 <!--#elif expr="$HTTP_USER_AGENT = '/MSIE 4/'" --> 
 version 4 
 <!--#elif expr="$HTTP_USER_AGENT = '/MSIE 5/'" --> 
 version 5 
 <!--#else --> 
 version (unknown) 
 <!--#endif --> 
 
<!--#elif expr="$HTTP_USER_AGENT = /Mozilla/  
&& $HTTP_USER_AGENT != /compatible/" --> 
you are using netscape navigator 
 <!--#if expr="$HTTP_USER_AGENT = /Mozilla\/3/" --> 
 version 3 
 <!--#elif expr="$HTTP_USER_AGENT = /Mozilla\/4/" --> 
 version 4 
 <!--#elif expr="$HTTP_USER_AGENT = /Mozilla\/5/" --> 
 version 5 
 <!--#else --> 
 version (unknown) 
 <!--#endif --> 
<!--#else --> 
you are not using microsoft internet explorer or netscape. 
<!--#endif --> 

 

 
TOPICS
getting started
domain registration | mail forwarding | checking mail | uploading your site
basic features
web stats | hit counters | form-to-mail cgi | redirect cgi | autoresponders |
basic mailing lists | advanced mailing lists | search engine submission | frontpage extensions | password protected directory | custom error pages | subdomains
advanced features
cgi scripts | server-side includes | php | mysql |

 
All your hosting dreams come true!
P R O F E S S I O N A L
hkhosting.com
W E B   S E R V I C E S

Copyright © 1999-2003 HK Hosting Ltd. All rights reserved. Terms & Conditions