Thread: PHP within HTML

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    70
    Rep Power
    14
    I'm failing miserably trying to insert the contents of a .php3 file within a .htm file via:

    <?
    include ("filename.php3");
    ?>

    The filename is in the same dir. I want the end result of postings to my .php3 file to be public through a 'traditional' html file.

    Any help much appreciated.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    29
    Rep Power
    0
    So you have a .htm file, with

    <?
    include("filename.php3");
    ?>

    if that is correct it won't work, the webserver would have to have the .htm extension setup to parse php, but that would tremendously slow down any html file, you can include html in php, but you can't include php in html .

    Vlad
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    I'm guessing that you have PHP set up to only parse files with a .php3 extention, in which case, your include() will be completely ignored. To test this, temporarily change the .html file to a .php3 file. If it works then, you need to set .html files to be parsed.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    70
    Rep Power
    14
    Scollo

    I thank you for your reply, although I'm confused by it re. the answer above.
    http://www.mysite/cgi-bin/php/_htaccess.txt has been added to to now read:

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

    but to no effect ... where do I go from here?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    36
    Rep Power
    15
    Are you running your own server? I assume not, otherwise you would change the Apache/PHP settings. The next question is, are you sure your PHP server is using the CGI version and not the module version (phpinfo should tell you)? I believe that what you are trying to do is only available with the CGI version, and most ISPs would be using the module version. I could be wrong about this though
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    .htaccess files need to be named .htaccess not _htaccess.txt Also these only work with apache, what web server are you using?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    70
    Rep Power
    14
    Yes, php scripts have always worked within .php3 files.

    The only (apparently relevant) info I can see from phpinfo() is:

    PCRE: Perl Compatible Regular ExpressionsPCRE library version: 2.05 21-Apr-1999
    GATEWAY_INTERFACE: CGI/1.1
    SCRIPT_FILENAME: /usr/local/php-bin/php.cgi
    SCRIPT_NAME: /php-bin/php.cgi

    Sounds like we're stuck with running scripts within .php3 files only.


  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    8
    Rep Power
    0
    You are trying to insert PHP into an HTML file. You need to create the HTML file and save it as .php3.

    Then, you can insert the include into the file.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Robert12345:
    I'm failing miserably trying to insert the contents of a .php3 file within a .htm file via:

    <?
    include ("filename.php3");
    ?>

    The filename is in the same dir. I want the end result of postings to my .php3 file to be public through a 'traditional' html file.

    Any help much appreciated.
    [/quote]



    ------------------
    Check www.crackheaded.com
  16. #9
  17. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Robert - look again at freddydoesphp's answer,you need to properly name your .htaccess file , if so it will work, I would however not set html pages to parse though just the .htm files.

    any php3 file then included will work!

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

IMN logo majestic logo threadwatch logo seochat tools logo