SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Does someone want to take a stab

    at explaining server-side includes, to me.

    Ive heard they are really useful. But my big, fat (and frankly expensive) book "Professional PHP Programming" doesn't have very much about them, .

    I'm using a template system with a big .inc file, and calling the page structure in each individual page.

    How do SSI's work, and do I need to use them?

    Thanks.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    SitePoint Enthusiast Jack@dwd.com's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are merely looking to include files within other files eg have a header.inc and a footer.inc, you should use the PHP function include().

    eg
    PHP Code:
    <?php
    include("header.inc");
    ?>
    HTML stuff here
    <?php
    include("footer.inc");
    ?>

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SSis are not PHP, they are a function of the Apache webserver. The most common use is including constant items, such as links on a website so that if you want to update the links you only have to update one file.

    Try something like this:

    <!--#include virtual="navbar.html" -->

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Jack@dwd.comIf you are merely looking to include files within other files eg have a header.inc and a footer.inc, you should use the PHP function include().
    Yeh, I'm already doing that.

    I thought pages using SSI have the .shtml extension? It seems like I am already using maybe the easiest/best way without going to FastTemplate.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On most servers SSIs pages have the extension .shtml, but it can be changed to anything. I did post details on how to do this using a .htaccess file here:

    http://www.sitepointforums.com/showt...&highlight=ssi

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And suddenly everything is clear.

    thanks
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


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
  •