Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User TrafficProducer's Avatar
    Join Date
    Sep 2005
    Posts
    1

    Question How do I embed php in html



    How do I embed php in html

    I've tried the below in the .htaccess but it does not run the php

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

    The call in a html page is:-

    <?php
    include_once("http://ns1.openhsp.biz/~acomput/apf4/amazon_products_feed.cgi?SearchIndex=Books&BrowseNodeName=Books");
    ?>

    Note, I need to change my domain name Nameservers to point to this.

    Thanks

    http://www.comparebargains.com/books.html

    Needs to call this:-

    http://ns1.openhsp.biz/~acomput/apf4...NodeName=Books

  2. #2
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    There should be no need to parse .htm and .html files with PHP.

    Why do you believe you need to do this?

  3. #3
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    There is nothing wrong with parsing html with php if you have the need to. We have several sites that do exactly this.

    if you are not running phpsuexec then you can add these lines to the virtual host entry in the httpd.conf.

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

    If you are running phpsuexec then its a 2 step process

    first you will need to add .htm and .html as server-parsed in the apache handlers section of cpanel

    then add these entries to the .htaccess file

    AddHandler application/x-httpd-php .htm
    AddHandler application/x-httpd-php .html
    AddType application/x-httpd-php .htm
    AddType application/x-httpd-php .html
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

  4. #4
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    The way to embed PHP into HTML is to rename the file to .php, then it will all just work. Seriously, why re-invent the wheel?

  5. #5
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    why reinvent the wheel is why we parse some html through php due to the fact if you change the file extension from .html to .php then you have to redo all page links and on a large site this can consist of having to edit several hundred pages. Lot easier to modify the php/apache engine to parse the .html through php.
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

  6. #6
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Fairy nuf, thought if I probed a little we might get a reason!

  7. #7
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    Quote Originally Posted by dave9000
    why reinvent the wheel is why we parse some html through php due to the fact if you change the file extension from .html to .php then you have to redo all page links and on a large site this can consist of having to edit several hundred pages. Lot easier to modify the php/apache engine to parse the .html through php.
    However this is only really a workaround to compensate for a poor URL structure.

    If your URLs are of the form http://example.com/directory/ then you could have http://example.com/directory/index.html or http://example.com/directory/index.php or http://example.com/directory/index.cgi etc.

    You shouldn't really have to concern your users with which server-side technologies you're using. Why should your choice of server-side techonologies affect your URLs?

    URLs of the form http://example.com/directory/ are just that little bit easier to recall (rather than trying to remember if the extension was .html, .php, .phtml, .etc) and it then allows you to use whatever server-side technologies you like without breaking all your links.

  8. #8
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I agree on your point however some people like to use frontpage navigation and themes etc with embedded php as a few of our customers use. Also one of our sites uses web pages linked into standalone exe's that have been in use for 10 yrs. In our case its a lot easier to modify the 1 website to our existing software base than to modify the site and the software just to keep page extensions proper
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

Similar Threads & Tags
Similar threads

  1. parsing php into html
    By monckey100 in forum Database Discussions
    Replies: 10
    Last Post: 09-18-2009, 07:12 PM
  2. need help AddHandler application/x-httpd-php .php .php4 .php3 .html
    By rustikat in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 03-03-2009, 06:01 PM
  3. --enable-embed=shared not available
    By akaber in forum New User Questions
    Replies: 1
    Last Post: 07-07-2008, 08:42 AM
  4. php html mailing
    By vihu in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-24-2007, 12:27 AM
  5. Embed Email Login?
    By MatreX in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-18-2004, 02:41 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube