SitePoint Sponsor

User Tag List

Results 1 to 18 of 18

Thread: SSI help?

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SSI help?

    My site is grouped in 3 columns.
    The left and right columns will always be changing.

    Now my site is focused on music, hence reviews, articles , interviews, ect ect.

    Now my problem is when I do these reviews and or articles I use the same format as the main page except the middle column is taken up by that given news article. While the left/right columns match the main page.

    So when a review is lets say 2 weeks old, the left and right side columns will be outdated.

    Can someone give me the exact code to put on these article pages, so when the left and right columns on the main page change it will simulataniously do it for all pages.
    Sorry for babbling, it was a little hard for me to explain.
    Ok if you can give me the code
    <---#execute
    or something like that it would be appreciated. Thank you, Regards

  2. #2
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two command lines you can use...

    <!--#include file="the_page_you_want_included.shtml" -->
    use this if the page you need to include is in the same directory as the page that has the command line.

    or

    <!--#include virtual="/the_page_you_want_included.shtml" -->
    use if the directories are different.

    Just place the appropriate command line in the table cell that you want the page to be included in.
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  3. #3
    SitePoint Zealot Aonghus's Avatar
    Join Date
    Feb 2001
    Location
    Ireland
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Saz249
    There are two command lines you can use...

    <!--#include file="the_page_you_want_included.shtml" -->
    use this if the page you need to include is in the same directory as the page that has the command line.
    Yes, but you use the .shtml extension for the page that includes the file, not the one that is included. So the page for your review is called 'my_special_review.shtml' , and in that file you have code a little like this:

    Code:
    <HTML>
       <BODY>
          <TABLE>
             <TR>
                <TD>
                   <!--#include file="first_column.txt" --> 
                </TD>
                <TD>
                   My flattering review...
                </TD>
                <TD>
                   <!--#include file="second_column.txt" --> 
                </TD>
             </TR>
          </TABLE>
       </BODY>
    </HTML>
    Note: The files don't need to be called whatever.txt, they could be whatever.htm etc. If the files being included are in a different directory, it'd look something like this:

    Code:
    <HTML>
       <BODY>
          <TABLE>
             <TR>
                <TD>
                   <!--#include virtual="../columns/first_column.txt" --> 
                </TD>
                <TD>
                   My flattering review...
                </TD>
                <TD>
                   <!--#include virtual="../columns/second_column.txt" --> 
                </TD>
             </TR>
          </TABLE>
       </BODY>
    </HTML>
    Hope this helps .
    Last edited by Aonghus; Jul 27, 2001 at 03:22.

  4. #4
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, sorry about that. I was under the impression that all the files used had to be named *.shtml - I've only just learned how to use SSI myself
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  5. #5
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Nope, the files that have the includes in them need to be .shtml or .asp.

    The files that are being included can be anything text-based that the server can read (personally I like .txt to remind myself that it isn't a "real" html file).
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  6. #6
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by studiococo
    Nope, the files that have the includes in them need to be .shtml or .asp.

    The files that are being included can be anything text-based that the server can read (personally I like .txt to remind myself that it isn't a "real" html file).
    But what if the included page has hyperlinks or rollovers, stuff like that. Surely you can't still name them as *.txt??

    You have to forgive my ignorance here - anything that remotely resembles programming is beyond me right now!
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  7. #7
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    yeah you can, cause it's being put into the .shtml (or.asp) file just like it had been written there in the first place.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  8. #8
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh right, great stuff.
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  9. #9
    SitePoint Zealot Aonghus's Avatar
    Join Date
    Feb 2001
    Location
    Ireland
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by studiococo
    Nope, the files that have the includes in them need to be .shtml or .asp.

    The files that are being included can be anything text-based that the server can read (personally I like .txt to remind myself that it isn't a "real" html file).
    On some servers, you can actually have includes in files called *.html or *.htm, although *.shtml is the norm

  10. #10
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    True. Actually all servers "can", you just need to setup some mime-types or whatever (I keep forgetting what they're called) on the server (same way you'd create a new extension).
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  11. #11
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I heard about that too, but my brain's not in the right gear to cope with that yet!
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  12. #12
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yeah, neutral is pretty harsh, eh?

    *runs*
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  13. #13
    Bimbo With A Brain! silver trophy Saz's Avatar
    Join Date
    Mar 2001
    Location
    Kent, United Kingdom
    Posts
    5,275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, it's more like reverse at times!
    Saz: Naturally Blonde, Naturally Dizzy!
    No longer Editor of the Community Crier.

    Don't mind me, I'm having a BLONDE moment!

  14. #14
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the prompt responses.
    It worked, but im having trouble on knowing where to place <!--#include virtual="/site/leftcolumn.txt" -->
    that.
    I try to place it in between whatever the left column has.
    For instance, if this was the txt file
    <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">

    <TR>
    <TD><IMG height=15 src="/images/bar_stuff.gif"
    width=134></TD></TR></TABLE>



    I would delete that entire part in the shtml file, and replace it with this
    <!--#include virtual="/site/leftcolumn.txt" -->

    Wouldnt I?
    If so my tabeling is having some problems.
    Any suggestions?

    Thanks Regards.

  15. #15
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes, that's exactly how you'd do it.

    See, the SSI just replaces the code where it would have gone had you written it on the page yourself.

    So, if there are any problems, it's likely to be the code itself instead of the SSI (though others may have other takes on it).
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  16. #16
    SitePoint Zealot Aonghus's Avatar
    Join Date
    Feb 2001
    Location
    Ireland
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bascially it takes out the <!--include etc. line out completely and replaces it with the enitre file you're including. Just picture the included file as part of the includer file (not that they're real terms tho)...

    As for setting up apache to allow SSIs in any file, I think you can do it with .htaccess but you can certainly change it in httpd.conf

    -Aonghus

  17. #17
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o thank god, you guys are great here. I completed it. It works great. But I was just curious how can I direct members to the index.shtml page, without having a intro/splash page?
    Is this possible?

  18. #18
    SitePoint Zealot Aonghus's Avatar
    Join Date
    Feb 2001
    Location
    Ireland
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When someone types in the address of your site, like www.yoursite.com, the server automatically looks through a list of files to see if they exist and redirect them to. So if www.yoursite.com/index.html exists it'll send the visitor there. If it doesn't, then maybe www.yoursite.com/index.htm does, and it keeps going down this list.. main.html is one, and it'll eventually come to index.shtml - if that exists then it sends them there. The order of this list depends totally on the server - I once uploaded a file called index.cgi, and the server sent all my visitors there instead of index.htm! Not only that, but it did all sorts of strange things when I FTPed into my account...

    Anyway, to cut a long story short , upload index.shtml, delete index.htm(l), and it should work fine.

    -Aonghus


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •