Some web hosts mention Server Side Includes as a feature. I have couple of unanswered questions about it. Please help me to get it right. (*) Can I upload a template, mark editable regions and change the template (At the server) when I want and spread the changes across all the pages that used it? (*) Or will have to use something like PHP includes. The matter here is, I want to have .html extension (or .shtml) rather than .php. (*) Is there a way to have SSI with .html extension? webgaya
First you need to make sure your host supports server side includes. You wouldnt use a template as the serverside include method makes it a lot easier. Create a page as normal but as shtml, enter the include code into the section of each page that you need such as the header, footer and sidebar. Using .htaccess (something else your host needs to support) place this into the file: AddHandler server-parsed .htm so when the page loads from the server it is fed as htm, you can also have it change to html Upload all your files and if you need to change the header, footer or side bar you edit the actual include file and upload it. The include file can be created using html code with notepad and saved as filename.inc Serverside include is a brilliant and easy way of creating sites - try it out with a test page to see if you like it.
Hi turfsniffer, Thank you for your response. It really encouraged me. My host provides SSI and access to .htaccess file. I am quite good at HTML but couldn't get it completely. Can you please provide a template with necessary steps. It will be a great reference to all of us. Thank you. webgaya.
This is what I did to get it to work.. Added the following line to the .htaccess file.. AddType text/x-server-parsed-html .html .htm Code (markup): Put what I wanted to include into a txt file, and saved/uploaded it. (filename.txt) Added the following line where I wanted the include to show.. <!--#include virtual="/filename.txt" --> Code (markup): That's it. Hope that helps.
Ing I personally use filename.inc and not .txt, will that still work? I just havent tried it like that. webgaya I am not the best at HTML but give this a shot. Open notepad and place the following code into it. Save the file into the root directory of your site as footer.inc Now open the html page that you want to add the include into such as the index page and look at the code. At the very bottom just before the body closes make sure the code is like this: Save it and upload. Depending on what program you are using to build your webpages you may not see the result until you upload it to your server. Dreamweaver will show the final result when you preview the page. So upload the html file and the footer.inc onto your host and test the results. Hope that makes sense
Turf, I've never tried filename.inc, only .txt I guess there's a few ways of getting the same result. webgaya, I'm glad you got it working. Ingrid