I want to parse html as php

Discussion in 'Apache' started by smetten, Sep 6, 2006.

  1. #1
    Hi,

    I want to parse html as php
    i added this line of code to my .htaccess file.

    But each time i try to load the page where there is php code it asks if i want to download the page and it doesn´t load the page.

    any ideas?

    This is how my .htaccess file looks.

    
    RewriteEngine OnRewriteCond %{HTTP_HOST} ^xorak\.com [nc]RewriteRule (.*) http://www.xorak.com/$1 [R=301,L] 
    
    AddType application/x-httpd-php .html 
    PHP:

     
    smetten, Sep 6, 2006 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    In your handlers you set html to sever parsed.

    But I don't think you can use php code on the html page. The only thing I have ever used is the include function.

    Most of this site is htm sever parsed and I merely use that function to include the header.html and footer.html. I used to have a menu bar on the left that was also included. I planned to include a sidebar. But have pretty much decided to just convert to php on the next rollout.

    Thinking as I was writing, you might be able to use php on the pages. Darn, now I have something I have to try. :)

    Edit: I used cPanel to set mine but I went and looked at the .hta file it just added this line to the file:

    AddHandler server-parsed htm

    So if you editing your own file that should be all you need.
     
    Colbyt, Sep 6, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use php on the pages. I use php on html, xml and asp pages on my sites by using the htaccess code.

    I can't see any errors in your code, maybe its a browser cache issue?
     
    mad4, Sep 6, 2006 IP