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.

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    13
    Member #
    13019
    Ok I have to say I'm a little confused, because a while ago I made a site using SSI, and it had no problem when linking the include elements from different directories.
    All I had to do was write
    <!--#include file="../../header.htm" --> instead of <!--#include file="header.htm" --> and it worked perfectly, all images and links in header.htm worked like a bliss.
    Now I'm making another site, and I can't get the same thing working for the life of me. Once the header is loaded into a page in a subdirectory, it thinks all its links are in that subdirectory, and they are not.
    Also, I have to use "include virtual" instead of "include file", if I want it to work at all.
    Could it be a difference between servers? The first one was a Windows platform, this second one is Linux. First one had no Apache, second one does.
    Is there any trick I can do in order to effectively use SSI with subdirectories? I mean, creating a new include file for every subdirectory kind of defeats the purpose of it, and there are waaay too many files in question for me to have them all in the same directory.
    Help?

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Try using absolute paths?

    As in,

    Code:
    <!--#include virtual="http://yourdomain.com/dir/header.htm"-->

  4. #3
    Junior Member
    Join Date
    Apr 2006
    Posts
    13
    Member #
    13019
    Hmm

    yeah I thought of that... I guess I'll do that, if there's nothing else?

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Well using absolute paths will solve your problem.

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    I have something else you might want to try ...

    Instead of using SSI (with the file extensions .shtml),
    try changing your extension(s) to .php and use this
    for your include(s):

    <?php include '../../header.htm'; ?>

    Go ahead and reference everything the way you "think"
    it should be... see if it works better -- I have a hunch that it will.

    The difference must be the way the server is configured,
    that's all I can think of.

    PHP offers the same thing as SSI, with an added bonus ...
    not only can you do includes, but you can actually do
    scripting (server-side) processing on-the-fly. Creating some
    features you may want to use in the future.


  7. #6
    Junior Member
    Join Date
    Apr 2006
    Posts
    13
    Member #
    13019
    Quote Originally Posted by mlseim
    I have something else you might want to try ...

    Instead of using SSI (with the file extensions .shtml),
    try changing your extension(s) to .php and use this
    for your include(s):

    <?php include '../../header.htm'; ?>

    Go ahead and reference everything the way you "think"
    it should be... see if it works better -- I have a hunch that it will.

    The difference must be the way the server is configured,
    that's all I can think of.

    PHP offers the same thing as SSI, with an added bonus ...
    not only can you do includes, but you can actually do
    scripting (server-side) processing on-the-fly. Creating some
    features you may want to use in the future.
    Ohh! Dammit I've already converted all paths to absolute... but, I'll try that too! If nothing else then for the future! Thanks!

  8. #7
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    Let me know if using PHP allows your relative path addressing ...

    I'm curious to see if you've discovered a server configuration issue with SSI.


    ==============

    One of the powerful things with PHP, is using sessions.
    (sort of like cookies, but the values are stored on the server, not the users PC).

    You can start a PHP session with a password entry and then, every page
    that has .php as the extension can display special things on that page if it
    detects the session. Or, you could have pages only display if the session is
    detected ... like an admin page. When the browser is closed, the session ends.


  9. #8
    Junior Member
    Join Date
    Apr 2006
    Posts
    13
    Member #
    13019
    [edit]
    No actually, it doesn't work, the php trick. The links are still broken, without absolute paths.

    Ah well, thanks anyway!


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 06:12 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com