help with server side includes SSI and site structure

Discussion in 'HTML & Website Design' started by branduin, Jan 28, 2007.

  1. #1
    I was wondering if anyone could offer a little help to me?

    I am working on taking a full site from ASP to SHTML (we had to switch servers, long story, etc). I don't know ASP and I usually use SSI for my sites. This site is much bigger and I would like to organize it a bite better than the previous webmaster. There are a number of sections (folders) and I would like to put each shtml file inside the folder for its section. The navigation is a SSI file. I have tried several different ways to do this without luck...

    Is there a way to have one main file for the navigation and have the files that are within the folders use that main file?

    Right now I have the navigation file (plus image files) copied into each folder and this really isn't the best way to do it I know! Should I be using CSS instead? I have been looking at the www.csszengarden.com website but I don't know enough about it yet and this site really needs to be switched over soon.

    Here is a simple example of my site structure, folders are in [ ]:

    html
    -[images]
    -[video]
    -video.shtml
    -[events]
    -index.shtml
    -navigation.shtml

    Is there a way that I can have index.shtml and video/video.shtml use the very same navigation.shtml include file?

    Any help or suggestions would be great!
    Branduin
     
    branduin, Jan 28, 2007 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    You'll need to indicate the relative path.
    
    <!--#include virtual="../events/navigation.shtml" -->
    Code (markup):
    cheers,

    gary
     
    kk5st, Jan 28, 2007 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I don't know they proper syntax for shtml files. If you were using php it would look like this.

    <?php include("directoryname/navigation.php"); ?> or maybe
    <?php include("http://domainname/directoryname/navigation.php"); ?>

    I think the syntax is something like <!-- some text or some commands -->

    Since you are making the change anyway, why not use php and open up a whole new world. Php delivers what server side includes teased us with years ago.


    EDIT: kk5st can type faster than me. :)
     
    Colbyt, Jan 28, 2007 IP
  4. branduin

    branduin Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Gary,

    Thanks for replying. I did try that but then the image links were all broken (each navigation link is a rollover image). Will that work if I use the full image path (ie. http://www.domain.com/images/home.jpg) for each image within the navigation file?

    Really? I would love to make things easier but it's hard not knowing the programing languages very well. Would you have any suggestions for me as to how to begin learning php for this site?

    Thanks,
    Branduin
     
    branduin, Jan 28, 2007 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    You could do that, but don't need to include the domain. You could make the path relative to the document root, i.e., start the address from the root /. Keep in mind that those image addys are relative to the final resting place, not where it started. If the nav file is included in files in a different directory, the path has a different starting point. Includes are essentially pasted into the document before it is served.

    cheers,

    gary
     
    kk5st, Jan 28, 2007 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    I think you will find php easier to use than ssi. At the most basic level it is simply used to include files and other information. Even if you don't use many of the functions, using php now it will lessen the SEO bite of renaming the files again in the future.

    I am going to send you a link and a note via PM to illustrate my point. I don't want to drop a link here.
     
    Colbyt, Jan 29, 2007 IP