Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    This is building off the example transio posted here

    First thing you need to do is make sure that your host has support for Server Side Includes (SSI)

    For this to work you need 3 files.
    The first being page.shtml
    page.shtml from transio's example
    --------------------------------------------------
    <!--#Include File="header.htm"-->
    Here's the content of my page
    <!--#Include File="footer.htm"-->
    --------------------------------------------------
    How this works:
    When someone requests this file in a browser (ex: http://www.site.com/page.shtml ) the server will take out the include lines and in their place it will put the files being referred to.
    If the file does not exist then you will see a very generic error inserted into the code in the include line's place
    [an error occurred while processing this directive]
    The second file being header.htm
    This file gets included by page.shtml and sets up a basic layout for everything to following it.
    header.htm
    --------------------------------------------------
    <html>
    <head><title></title></head>
    <body>
    <table>
    <tr>
    <td>
    <a href="home.shtml">Home</a><br>
    <a href="page.shtml">Page</a><br>
    <a href="page2.shtml">Page2</a><br>
    <a href="page3.shtml">Page3</a><br>
    </td>
    <td width="100%">
    --------------------------------------------------
    The final file being footer.htm
    footer.htm basically closes out all the tags started in header.htm but it can be used for other things that are included at the bottom of all pages of a web site (ex: copyrights, etc.)
    footer.htm
    --------------------------------------------------
    </td>
    </tr>
    </table>
    </body>
    </html>
    --------------------------------------------------
    I have also uploaded an image graphically explaining how this process works. Actual files will follow in subsequent replies.
    Attached Images Attached Images
    - Brian

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    Here's a link to the files on my server.

    Reason being .shtml file extensions cannot be uploaded here more than likely for security reasons.

    page.shtml
    header.htm
    footer.htm

    IMPORTANT: You must name this file with a .shtml extension or this will not work even if your host supports SSI
    - Brian

  4. #3
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,656
    Member #
    1234
    Liked
    137 times
    You might want to redo the header file so that it goes across the top, as well as throw something in the footer, just so it's easier to look at. Right now, your header is on the left
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    If you're going to turn this into a tutorial, you might want to include the following in addition to SHTML:

    ASP Includes
    Code:
    <!--# include file="controls.jsp" -->
    PHP Includes:
    PHP Code:
    <?php include("header.htm"); ?>
    JSP Compiled Includes:
    Code:
    <%@page include="controls.jsp"%>
    JSP Inline Includes:
    Code:
    <jsp:include file="header.jsp" />
    JSP Inline Includes with Parameters:
    Code:
    <jsp:include file="header.jsp">
        <param name="title" value="Web Design" />
        <param name="keywords" value="Web, Design, Web Design" />
    </jsp:include>

  6. #5
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    PHP is:
    PHP Code:
    <?php include("/path/to/file.php"); ?>
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    LOL... fixed it, thx.

  8. #7
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    when i do that, it says this:
    Warning: main(/v4/nav.html): failed to open stream: No such file or directory in /home/virtual/site20/fst/var/www/html/v4/members/krazy.php on line 49


    and line 49 is where it includes it, obviously. i dont get it.
    Ad space - for sale, $19.95/month

  9. #8
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    It's the equivalent of a 404 (file not found) error. Make sure that you're including the file from the correct path (and name, of course).
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  10. #9
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    the file is there and it leads to the right place..

    <?
    php include("/v4/nav.html");
    ?>

    isnt that right?
    Ad space - for sale, $19.95/month

  11. #10
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    "/" at the beginning of a url defines a path relative to your web root (xyz.com).


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:39 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com