IT Community - Software Programming, Web Development and Technical Support

What is SHTML? How to Implement SHTML and its uses?

This is a discussion on What is SHTML? How to Implement SHTML and its uses? within the Other Web Programming Languages forums, part of the Web Development category; A Web file with the suffix of ".shtml" (rather than the usual ".htm") indicates a file ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Other Web Programming Languages

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-15-2007, 10:36 PM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default What is SHTML? How to Implement SHTML and its uses?

A Web file with the suffix of ".shtml" (rather than the usual ".htm") indicates a file that includes some information that will be added "on the fly" by the server before it is sent to you.
SHTML is really not a "thing" so much as an extension used by Web servers to define a document that has Server Side Includes (SSI). SSI allows you to add real-time interactivity to your Web pages without programs or CGI. The drawback is that it requires that SSI be turned on for the Web server.
You use SSI to do things like add dates and times that change with each page access, database queries that display the results on the page, and displaying different information depending on the browser, DNS or IP, operating system, or other variables.
Shtml is so easy, and yet so efficient. Shtml is like frames within the html code. You have the top of the page, such as links, a menubar, or links. Save all the text in the top of the page as "top.html". Then we come to the content of the page. This should be called whatever the page is called. Such as, you have a page with links, you call the page "links.html". Then you have the bottom of the page. This closes all html tags. Save this last page "bottom.html". Now combine all the code from these pages together and you get the complete page. Well, obviously you are not done! One more simple step. You need to add the shtml code, and bring them all together using shtml.

Shtml syntax. You would think it would be hard and complicated to put it all together.

<!--#include virtual="top.html"-->
<!--#include virtual="links.html"-->
<!--#include virtual="bottom.html"-->

You would save this page as "links.shtml"
It will stack the code and put it all together.
Here is a sample...
<html>
<title>Shtml sample :: Links </title>
<body bgcolor="#ffffff">
<table width="500" border="0"
<tr>
<td>Header Links</td>
<td><a href="http://www.within-reason.com" target="_blank">Within-Reason.com</a></tr>
<tr>
<td> ... now save this as "top.html"

There is the top of the page... now we have the content in the middle.

<a href="http://www.designsbymark.com" target="_blank">Design's By
Mark</a>
-Great Photoshop Tutorial's Overall good webdesign
Page.<br>
<a href="http://www.screamdesign.com/" target="_blank">Scream
Design</a>
-Also a good site for photoshop tutorial's<br>
<a href="http://www.computerarts.co.uk/tutorials/2d/" target="_blank">Computer
Arts</a>
-Very good tutorial's for photoshop and other's<br>
<a href="http://www.russellbrown.com/body.html" target="_blank">Russel
Brown</a> -Good photoshop tips

This middle part would be saved as "links.html"

Now we come to the end. This part closes all the HTML Tags used above. And add copywrite or closing statements.
</td></tr>
</table>
<p align="center">Copywrite 2001 Shtml Tutorial</p>
</body>
</html>
Now save this part as "bottom.html"

This was a simple example but you can include as many files as you want. Shtml can save a lot of time and energy.
SSI Directives
SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.

The decision of when to use SSI, and when to have your page entirely generated by some program, is usually a matter of how much of the page is static, and how much needs to be recalculated every time the page is served. SSI is a great way to add small pieces of information, such as the current time. But if a majority of your page is being generated at the time that it is served, you need to look for some other solution.

Basic SSI directives
SSI directives have the following syntax:

<!--#element attribute=value attribute=value ... -->

It is formatted like an HTML comment, so if you don't have SSI correctly enabled, the browser will ignore it, but it will still be visible in the HTML source. If you have SSI correctly configured, the directive will be replaced with its results.

The element can be one of a number of things, and we'll talk some more about most of these in the next installment of this series. For now, here are some examples of what you can do with SSI

Today's date
<!--#echo var="DATE_LOCAL" -->

The echo element just spits out the value of a variable. There are a number of standard variables, which include the whole set of environment variables that are available to CGI programs. Also, you can define your own variables with the set element.

If you don't like the format in which the date gets printed, you can use the config element, with a timefmt attribute, to modify that formatting.

<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" -->

Modification date of the file
This document last modified <!--#flastmod file="index.html" -->

This element is also subject to timefmt format configurations.

Including the results of a CGI program
This is one of the more common uses of SSI - to output the results of a CGI program, such as everybody's favorite, a ``hit counter.''

<!--#include virtual="/cgi-bin/counter.pl" -->
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-28-2007, 03:08 AM
sathian sathian is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 252
sathian is on a distinguished road
Default Re: What is SHTML? How to Implement SHTML and its uses?

SHTML

SHTML is HTML that is basically processed on the server prior to it being served in the browser. You can use it to include files to help you wiht easy changes.

For example, you can create a nav.html file to be included into an SHTML file. And then, when you add a new page, instead of changing ten pages, you only need to change one page. And then your nav will be updated on all pages. As far as building a site with SHTML - it is still HTML, but it is parsed on the server.

.shtml extensions.


* Server Side Includes and Performance Considerations: Why the .shtml extension is used

If an html document contains "Server Side Includes" that means that it includes special commands for the Server to process. This is normally how things like counters are done on basic web pages.

On some websites, the webmaster sets up the server to parse, or read through every .html or .htm file to see if it contains server instructions. However, this WILL slow things down when people link to the pages.

So, many webmasters have instituted the .shtml files. This is simply a naming convention that says "This html file includes Server commands - please parse it before delivering to the browser site" (hence the "s"). That way parsing can be skipped for all "plain" .html [or .htm] files.
* Alternatives to the .shtml extension

It doesn't have to have "shtml" - that's just the most commonly-used convention. But if it's used, it's used because your webmaster decided that that was the one they would pick. And if they did pick it, they may or may not have set up your server so that it would look for a default file of EITHER "index.shtml" or "index.html" (Some servers, as mentioned, can't have more than one file name as a default, and some webmasters don't think of doing this, which can complicate your Welcome page if you want to use server-side includes). Some other names you may see are .phtml (for Parsed HTML) and even .chtml (for Command HTML). Again, it's up to the webmaster, but .shtml is pretty standard these days. Microsoft's Internet Information Server (IIS) uses .ssi as a three character extension for .shtml file.
* Two More Server-Related File Extensions: .cgi and .asp

CGI stands for Common Gateway Interface. CGI files cause events to happen on the Server, normally through executing programs written in PERL, C, C++, or other programming languages. This is often used for things like database access, creation of customized HTML files, forms processing, and so on. Many CGI files use a .cgi extension, which can be set up to tell the Server that special handling or permissions are required for the file. You will not normally have a .cgi file as your default file in a directory, but if you do, you may run into the same kinds of issues as you do with .shtml files.

With the introduction of ActiveX, Microsoft has also introduced a new kind of server side file, Active Server Pages. These pages provide Server side ActiveX processing. These can perform many of the same functions as .cgi scripts, but are integrated into the ActiveX environment for Servers like IIS which support ActiveX. These files use the extension .asp. On some sites, again, depending on what the webmaster wants to do, HTML files which are generated from ActiveX scripts, or even HTML files which simply call ActiveX scripts, may also use the .asp extension. As with CGI, this becomes particularly important to you when you want to use a .asp file as the default file in your directory, and you may have to discuss the issue with your Webmaster.

Thanks
Sathian.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-01-2008, 10:43 PM
vijay vijay is offline
D-Web Trainee
 
Join Date: Jan 2008
Posts: 4
vijay is on a distinguished road
Default Re: What is SHTML? How to Implement SHTML and its uses?

Thanks a lot for providing me these useful in formation about SHTML.
Thanks a lot!
__________________
web site design
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-06-2008, 01:55 AM
suman suman is offline
D-Web Trainee
 
Join Date: Aug 2008
Posts: 27
suman is on a distinguished road
Default Re: What is SHTML? How to Implement SHTML and its uses?

Hi this is suman

Thanks for giving me this great knowledge.
__________________
Free templates
web design company
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-17-2008, 09:47 PM
getzephyr getzephyr is offline
D-Web Programmer
 
Join Date: Dec 2007
Posts: 53
getzephyr is on a distinguished road
Default Re: What is SHTML? How to Implement SHTML and its uses?

Useful information..... thx for sharing.
__________________
Test Management
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to implement threading in VB.Net? amansundar VB.NET Programming 2 10-30-2007 06:41 AM
How to implement Multithreading in Java? mobilegeek Java Programming 3 09-11-2007 05:08 AM
Implement SVN in APACHE vadivelanvaidyanathan Server Management 1 08-28-2007 06:18 AM
What is Cryptography? How to implement MD5 ? H2o General Web hosting Discussions 1 07-21-2007 12:04 AM
How to Implement SEO to a ASP.NET Web Application. prasannavigneshr Search Engine Optimization 1 05-12-2007 02:06 AM


All times are GMT -7. The time now is 01:57 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0