Results 1 to 7 of 7

Thread: php embedded in .htm pages

  1. #1
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default php embedded in .htm pages

    I can get my PHP scripts running when they are in .php files.

    Is it possible to embed php scripts in .htm files?
    Cheers
    Billy

  2. #2
    Join Date
    May 2005
    Location
    Hawaii
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you are running Apache and can use .htaccess, your in luck. Create a new .htaccess file and then in the file save the following:
    HTML Code:
    # Make all PHP code look like HTML
    AddType application/x-httpd-php .htm .html
    then you sould be able to embed php in a .html/.htm file.

  3. #3
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that.

    I'll give it a shot
    Cheers
    Billy

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Why do you want to do this?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    So I won't have to change the names of all my pages and laa the links hrefs.
    Cheers
    Billy

  6. #6
    Join Date
    Dec 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile thank you

    I registerd in this forum to thank you
    perfect answer

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    It makes sense that you would want this, but--

    1. You could run a PHP script to rename all .htm files to .php if you'd like.
    (Loop through all directories and rename any *.htm to *.php.)

    2. If you do override the .htaccess like that, you'll make your server work a bit harder making EVERY .htm file run through the PHP parser when they don't all need to.

    Anyway, it's a valid option if these aren't too discouraging.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •