SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: html include

  1. #1
    SitePoint Guru toasti's Avatar
    Join Date
    Feb 2004
    Location
    Grahamstown
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html include

    Does anyone know if it is possible to include files with pure html, for example an html equivalent to
    Code:
    <?php include('file.php') ?>
    Thanks

  2. #2
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post in the HTML forum, they may be able to help

  3. #3
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nah they dont. Including a file is locating a file and then using it. As HTML is client side, it doesnt have the ability to look files up on a server like PHP, ASP etc do. Just use the code you posted in the top of your HTML document?
    If knowledge is power - Why isn't our army librarians?!
    Statistics show that 63% of all statistics are fake.
    When i was little i broke my neck, and i havent looked back since .
    I completed the internet in 1 week. The end boss was pretty easy though .

  4. #4
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. You need some type of server side language. Just use PHP. If you need to keep your extensions as *.html, then put this in .htaccess:

    Code:
    AddType application/x-httpd-php .php .html

  5. #5
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I 'think' you can do this..... i remember a guy in a recent post saying so.

    <!--#include file="filename.html" -->

    Just add that in the html file.

  6. #6
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Again, with that you'll need a line in .htaccess saying that the file should be server parsed. Or, you can change your extension to *.shtml. I used to do that, actually...

    I would just recommend using PHP.

  7. #7
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn, i forgot that bit, they guy in the post before said the extension would need to be .shtm

  8. #8
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think *shtm and *.shtml are the same... like *.htm and *.html

  9. #9
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, that was just a typo..... i did mean to typ .shtml!

  10. #10
    SitePoint Guru toasti's Avatar
    Join Date
    Feb 2004
    Location
    Grahamstown
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah. problem is im making the site for a friend who has never done any coding before. so i want to keep it simple and let them just use dreamweaver to update their webpage. using php means that they need to have php installed on their computer and understand localhost and all that.

    I guess i could just tell them to make the changes in dreamweaver and test it live though...

    The site is for a campus society, using the varsity alotted webspace, so they get min permissions on the server, im pretty sure they dont get access to .htaccess files.

    Thanks for your help though.

    post in the HTML forum, they may be able to help
    ..yeah, but this is where all the clever ppl hang out

  11. #11
    SitePoint Guru toasti's Avatar
    Join Date
    Feb 2004
    Location
    Grahamstown
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Young Twig
    Again, with that you'll need a line in .htaccess saying that the file should be server parsed. Or, you can change your extension to *.shtml. I used to do that, actually...
    so i can use the #include thing if i save files as .shtml? (provided the server supports .shtml?)

  12. #12
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, thats right...... I should imagine that the server supports it!


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
  •