Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What does this "#include" mean?

    Hello everybody,

    I am studying a series of pages that use a CSS as well as three files with these names: navigate.inc header.inc footer.inc

    Sadly, neither the menu, header, or footer appear on the pages when viewed by a browser.
    There are statements inside several <TD> tags such as
    <!-- #INCLUDE FILE="header.inc" -->
    <!-- #INCLUDE FILE="footer.inc" -->
    <!-- #INCLUDE FILE="navigate.inc" -->

    I understand that "<!" is a comment line, so I assume I need to add something to make these three components work.
    Can someone help me out with this?
    What does #INCLUDE mean, or do.... and what is an *.inc" kind of file?

    Many thanks for any help you might offer. I gotta start somewhere

    Paul

  • #2
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    An include is a code snippet which includes one file into another. I tend to use PHP includes rather than SSI, but I think you should just leave those comment tags there.

    The ".inc" part of the file-name is just an extension to make it easier to distinguish between included files and other files.

    You might want to search Google for "SSI" or "PHP Includes" to find out more, as I'm sure you'll be able to find out more than I could tell you .

  • #3
    Senior Coder JamieR's Avatar
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    3,161
    Thanks
    0
    Thanked 5 Times in 5 Posts
    For some reason, I never had any luck with SSI includes when I tried them

    I use PHP includes. To do so, and if your server supports it, use this simple code:

    PHP Code:
    <?php include("yourpage.php"?>
    Jamie

  • #4
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is a small tutorial that may be of some benefit. There are probably better ones out there on the net so google it as chilipie suggested. In the original post you had <!-- #include file="navigate.inc" -->. This is a common use for this. If you have a large site, say 100 pages or so and you want to have a common menu on every page or at least the majority of pages you can create one menu page and include it in all the pages you want the menu to show up. This way if the menu changes, and they always do, you simply have to update the menu page instead of all the pages with the menu. Also you are not limited to .inc. You can call your page whatever suits your needs. For menu pages you could use menu.nav if you want. Also your include files should contain anything that is generally used between the body tags. Although some browsers may allow you to use head and even doctype it is probably not a good idea. It may work but would probably cause validation problems (???). As you will find the include directive is really a small (limited) pre-processing language in which you can do quite a few things. My experience is limited to the use of the file attribute. I am not familiar with php (one of these days I've got to sit my wrinkled old butt down and learn this) but I have used ssi to include a variety of files for some of my projects without any problems. Also you have to ensure that your server supports it.

    Good Luck

    BaldEagle

    [edit]

    oops, i forgot the tutorial link:

    http://http-server.carleton.ca/~dmcfet/html/ssi.html
    Last edited by BaldEagle; 05-26-2005 at 06:59 PM.

  • #5
    Senior Coder JamieR's Avatar
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    3,161
    Thanks
    0
    Thanked 5 Times in 5 Posts
    I usually just use it for the news and navigation parts of websites. It doesn't cause any validation problems if your code inside the included file is semantic and valid.

  • #6
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chilipie
    I tend to use PHP includes rather than SSI
    That statement doesn't make sense. Server-Side Includes (SSI) are an idea. PHP is one of many languages that supports the idea.

    <!-- #inlclude -->

    and

    <?php include(); ?>

    are two seperate implementation of one idea.

  • #7
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, my bad .

    What I was trying to say is I use <?php include(); ?> more often than <!-- #include file="" -->.

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by chilipie
    Sorry, my bad .

    What I was trying to say is I use <?php include(); ?> more often than <!-- #include file="" -->.
    If you aren't using any other aspects of PHP, you would be better of just using SSI so the PHP engine doesn't have the parse the page and the subsecuent includes.
    OracleGuy

  • #9
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Gah! Why must you continue the confusion? PHP includes are SSIs... SHTML includes are SSIs...

    SSI !necessarily= SHTML includes...

    Semantics, yes, but it's a significant distinction. No need to muddy the waters.


  •  

    Posting Permissions

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