Forum Moderators: open

Message Too Old, No Replies

How do you use Server Side Includes?

         

quartzy

7:30 pm on Jul 12, 2009 (gmt 0)

10+ Year Member



I want to make some SSI's but my website is quite large, can I make the includes and the webpages all HTML? If so, how would I add the link, and where, at the top of the page, or where I need it.

swa66

8:16 pm on Jul 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SSI:
- you configure it in the apache configuration of the .htacceess file.
- in your html source you can now add things like

<!--#include virtual="/menu.part"-->

Teh include will replace that comment after processing and be handed to the browser.

quartzy

4:25 pm on Jul 13, 2009 (gmt 0)

10+ Year Member



Thanks but where would I place this link? Where it is needed or at the top of the page? And I dont need to make my webpages shtml?

encyclo

4:41 pm on Jul 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You add the include comment exactly where you need the included file to show up in the source code once it has been parsed. Whether you need to name your pages with a .shtml extension will depend on your server's configuration. It is sometimes possible to override the default configuration depending on the permissions the server's administrator gives you.

Bear in mind that SSI is not as adaptable or flexible as other solutions such as using PHP. If you are planning on changing your site to a dynamic one in the future, you might want to use a more advanced scripting langage instead of simple SSI.

jbinbpt

4:42 pm on Jul 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put that code where you need it to appear.

Create an .htaccess file and include the following so your file names can be .html

AddType text/html .shtml
AddHandler server-parsed .html
Options +includes

quartzy

5:07 pm on Jul 13, 2009 (gmt 0)

10+ Year Member



OK thanks for both of these comments, I will try that, and get a message to my server, In the future I will make my webpages dynamic, but too many links to change for now. Hope the server will accept HTML.