SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: PHP Includes

  1. #1
    Non-Member lostseed's Avatar
    Join Date
    Sep 2005
    Location
    Zurconion Soon!
    Posts
    1,549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Includes

    I have a site Im doing for a guy, and I had *.php extentions.

    But he keeps saving them to *.html when he changes content lol.

    Can I have HTML pages and use <?php include();?>, or do I need to try
    SSI which is something like <!--#INCLUDE FILE = "header.html" -->.

    Would SSI be wiser to use for this case? Im not sure because Ive never
    used any SSI. I dont know if it requires a service offline to view, and if
    it requires anything to view online.

    He is on a UNIX host with Apache and PHP5 so I thought I'd ask for the
    best suggestion. Any help is appreciated, thanks

  2. #2
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Putting this in your .htaccess will cause .html files to parse as php:
    Code:
    AddType application/x-httpd-php .html

  3. #3
    Non-Member lostseed's Avatar
    Join Date
    Sep 2005
    Location
    Zurconion Soon!
    Posts
    1,549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, you just changed my life haha

    Ill try that one out, ssweeet!

  4. #4
    Non-Member lostseed's Avatar
    Join Date
    Sep 2005
    Location
    Zurconion Soon!
    Posts
    1,549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The PHP Includes aren't working
    Does this only work on a live server, because im testing it on my localhost

    Its in the root of the folder with all pages (I didnt make subfolders)

    .htaccess
    AddType application/x-httpd-php .html

  5. #5
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must have htaccess enabled... Did you have any other rules in .htaccess that were already working?

  6. #6
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ... see this article:
    Code:
    # this must be present in httpd.conf
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

  7. #7
    Non-Member lostseed's Avatar
    Join Date
    Sep 2005
    Location
    Zurconion Soon!
    Posts
    1,549
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great article, Ill have to do some more testing an actually upload it to a temp
    directory, or Ill try changing my apache config file to read htaccess as shown
    in the article, thanks

  8. #8
    SitePoint Member
    Join Date
    May 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have been trying to get php to parse on files with .htm extensions recently. This is to use PHP includes.

    I tried this in the .htaccess:

    AddType application/x-httpd-php .php .html .htm

    But this didn't work.

    Then I tried this, which worked:

    RemoveHandler .html .htm
    AddType application/x-httpd-php .html .htm

    I don't know why it works as i'm new to server stuff.

    I found it on this page:
    http://www.peoplecnc.com/parse_php_into_html.html


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
  •