PDA

View Full Version : Why shtml?



Flying Mullet
10-30-2003, 06:45 PM
What are the benefits of shtml over html? Either a condensed response or a link to an answer will do. More of a curiosity on my part.

Endless
10-30-2003, 07:39 PM
shtml = html + ssi includes; that's pretty much the only difference. And if one really needs ssi, it can be set so that regular html pages can use it.

Flying Mullet
10-30-2003, 07:41 PM
Ahh, well that is easier than using a javascript method to write static html to the document.

Dr Unne
10-30-2003, 10:23 PM
SSI is nice if you want to embed CGI scripts into HTML documents, or include external HTML files into an HTML file. I've never had any use for it other than that. If you have a bit of HTML (a header for example) that a hundred pages on your site all use, you can have each of the pages fetch that header from a separate file rather than having to change it 100 times if you ever update it. So it can be used for a kind of primitive templating system.

Many hosts disable SSI though because it can be a huge security risk, and if you use it too much it can be a mild CPU hit because you're fetching and building files on the fly every time anyone views your site, though I'm pretty sure most servers nowadays can more than handle it.

Flying Mullet
10-30-2003, 10:28 PM
Yeah, I can see it's benefit for static navigation, headers, footers, etc...

I would use it for my site but the navigation header and such need to be dynamic depending upon which page is being shown. Is there anyway to pass parameters to these external file or are they pretty much straight html? Right now I call a javascript method at the beginning of my body that writes the header code to the document and depending upon which page "index" is passed in I set that page to selected in a drop down list.

Dr Unne
10-31-2003, 01:36 AM
I'd use Perl for something that had to be dynamic, but that's just me. Don't know any pure SSI way of doing anything other than "import the text from file x" or "run CGI script x and import the results".