Emo
Dec 10th, 2000, 01:07 AM
I have a quesion... Why do thay need all those different extentions like:
.htm
.html
.jhtml
.php
.xml
.cgi
.And the rest of 'em
Thanks
-Emo
HarryW
Dec 10th, 2000, 01:27 AM
Well it's to tell both the client and the server what kind of file it is, so that they know what to do with it. If it's plain text (.txt) then the server knows to just hand the file over as it is, and the client knows to display it as plain text with no formatting, just like in Notepad.
If the file extension is .htm or .html (some platforms only support 3 characters for file extensions so this is sometimes reduced to .htm) then the server knows that, again, it should just hand over the file as it is, but now the client knows that it contains HTML tags for formatting, and it should be displayed as an HTML document and not as plain text.
If the file is .php then the server knows that instead of just handing the file over it should pass it through a PHP interpreter first (PHP is a server side scripting language), and the PHP interpreter will produce an HTML formatted document to be sent to the client. The client knows that it should be displayed as an HTML document.
CGI stands for Common Gateway Interface, and .cgi files are basically executable files that run on web servers and run according to parameters specified by a user. For example, when you buy something over the internet, often the website will use a CGI program to handle the order data. It is an alternative to server-side scripting.
Basically then, the extensions are to identify the content of the file, so that both the client and the server know what to do with them.