Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

what is shtml ?

Options
  • 27-02-2006 6:35pm
    #1
    Registered Users Posts: 872 ✭✭✭


    Hi.

    I am trying to find out a way of including html files within other html files.

    I know this is possible with scripting languages but someone mentioned that you can do it with .shtml pages.

    Can anyone tell me if this is true and what .shtml pages actually are

    thanks


Comments

  • Registered Users Posts: 9,195 ✭✭✭RobertFoster


    You can include certain cgi scripts, and like you said, HTML files in shtml. It's part of Server Side Includes.


  • Registered Users Posts: 2,157 ✭✭✭Serbian


    Read all about Server Side Includes. Alternatively, if you have PHP enabled on your server, you can include files like so:

    [php]<?php
    include ("somefile.php");
    ?>
    <html>...
    [/php]


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    the .shtml is the default for the apache SSI.
    Don't confuse this with other server-side languages. SSI is pure apache :)


  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    There are all kinds of ways of doing it. CGI, PHP etc. I guess it depends why you want to do it. Some scripting languages are more appropriate for specific tasks.


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    blacknight wrote:
    the .shtml is the default for the apache SSI.
    Don't confuse this with other server-side languages. SSI is pure apache :)

    Well, it's a parser module for Apache. So, if you want to be pedantic, is PHP :)


  • Advertisement
  • Registered Users Posts: 1,801 ✭✭✭cormee


    grahamor wrote:
    Hi.

    I am trying to find out a way of including html files within other html files.

    I know this is possible with scripting languages but someone mentioned that you can do it with .shtml pages.

    Can anyone tell me if this is true and what .shtml pages actually are

    thanks

    Yes it's true - .shtml is the extension given to .html files to tell the web server to parse the page for server sides includes, apart from the 's' and the actual included file there is no real difference between it and a standard .html page.

    If you don't want to use the .shtml extension but still want your server to parse .html files for includes edit your .htaccess file and add the following line:

    AddType text/x-server-parsed-html .html

    Doing this can slow down your server as it has to parse every .html document opened but you wouldn't have to worry about such performance issues unless it was a very high volume traffic site.

    You embed the file you want to include on your webpage using the following code:

    <!--#include virtual="/path/to/your/file.inc" -->

    Your 'file.inc' would be a standard html page (minus <head></head> and <body></body> tags) saved with a .inc extension


    So for example test.html, whose code is

    <title>Test page</title>
    </head>
    <body>
    <p>This is a <!--#include virtual="sample.inc" --></p>
    </body>
    </html>

    And a file called sample.inc whose code is

    <p>test</p>

    Would create a webpage that simply says 'This is a test'

    ...that's about it I think.


Advertisement