How to make a html page so it brings up a php page

Discussion in 'Programming' started by pavelbarchuk, Jun 28, 2009.

  1. #1
    I need to make a html page, the normal, meta tags, header/footer, and between the body area, i need to drop a php page. In other words, i want a php page opening up in a html page.

    Is there a code, html or php so i can make another page appear in the html page without iframes?
     
    pavelbarchuk, Jun 28, 2009 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    you can combine both html and PHP. just put the html outside of PHP tag
     
    javaongsan, Jun 29, 2009 IP
  3. mioot

    mioot Peon

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To parse the php code in .html extenction , just add the following line of code in .htaccess file .

    AddType application/x-httpd-php .html .htm
     
    mioot, Jul 1, 2009 IP
  4. techbongo

    techbongo Active Member

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Probably no other way than iframe. But you can add a php page inside another php page and later, you can call the main php page as a html page with the help of modrewrite.
     
    techbongo, Jul 1, 2009 IP
  5. WoRLDLiFE

    WoRLDLiFE Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    .htacess is solution for your query.
     
    WoRLDLiFE, Jul 1, 2009 IP
  6. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #6
    Why not just use SSI... something like

    
    <html>
    <head>
    <title>Your Title</title>
    </head>
    <body>
    <!--#include file="php_file.php" -->
    </body>
    </html>
    
    Code (markup):
    that way you can keep the .html extension as the default or whatever. It also makes things a bit safer (in terms of passing variables through GET)

    If you can change the extensions, simply use PHP and put the HTML around the PHP tags
     
    tguillea, Jul 1, 2009 IP
  7. pavelbarchuk

    pavelbarchuk Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks. i will try doing that.
     
    pavelbarchuk, Jul 1, 2009 IP
  8. pavelbarchuk

    pavelbarchuk Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thanks for the help, but i figured it out. It works great...
     
    pavelbarchuk, Jul 2, 2009 IP
  9. proson

    proson Well-Known Member

    Messages:
    573
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #9
    you can embed any html in a php file.

    just do,

    
    <?php 
    
    //insert your php code here
    
    ?>
    
    <!-- type your normal html here -->
    
    
    Code (markup):
    hopes that helps
     
    proson, Jul 2, 2009 IP
  10. techbongo

    techbongo Active Member

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #10
    It's expected to read the topic and all the posts in a thread carefully before replying. The thread starter asked how a PHP file can be added inside an HTML file. You replied just the opposite. Please take care of these issues. I think, the best solution is already given above by tguillea.
     
    techbongo, Jul 2, 2009 IP
  11. pavelbarchuk

    pavelbarchuk Peon

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yea, but his way didnt work so i had to find another way.
     
    pavelbarchuk, Jul 2, 2009 IP
  12. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #12
    its simple...
    just make a HTML page, design it, then save it as PHP.
    once u've saved it as PHP then u can easily code ur php script anywhere on the page within the <?php ?> tags. :)
     
    shaibibutt, Jul 5, 2009 IP
  13. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #13
    there is another way of doing so
    Make a separate PHP file then include the file in HTML file. Syntax is

    <html>
    <body>
    <?php include("abc.php");>
    </body>
    </html>
     
    shaibibutt, Jul 5, 2009 IP
  14. techbongo

    techbongo Active Member

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #14
    I don't understand, why folks are not focusing on the title. The question was just opposite. We know, how to add a .html or .php page inside a .php page. But the thread starter wants to know (infact me too), how to add a .php file inside a .html file. If the file extension is .html and we write php codes there, the code will not be ececuted and will be shown as plain text. Though, a .html page can be used a .php page only using modrewrite. But any working idea of the exactly asked question is highly expected.
     
    techbongo, Jul 5, 2009 IP
  15. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #15
    I think to run PHP code u hav 2 save that page with .php extension.
     
    shaibibutt, Jul 20, 2009 IP
  16. techbongo

    techbongo Active Member

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #16
    No offcourse not. You can execute php codes written inside any file. I mean, it really doesn't matter what extension the file is saved with. But, you must have apache server and some knowledge on apache mod rewrite.
     
    techbongo, Jul 20, 2009 IP