PHP and HTML

Discussion in 'PHP' started by mantodeus, Jan 6, 2008.

  1. #1
    Hi

    How I can add HTML content in PHP script ? I made HTML page and copy source,paste it in php document but this was big ignorance ...PHP and HTML are totally different languages.Can I integrate HTML in PHP script ? Is there any documents in the web where I can read about php tags and how to add my content in PHP script ( tables,bold letters,fonts,forms,div tags).

    OR

    Can I add some code in php script which will execute HTML page uploaded on server.Let's say that I have index.php and blq.html - Is it possible html to be opened in index.php.When I open page index.php to see content of blq.tml in the middle of page ?? I know that my question is little confusing and unclear but I hope that you will understand me :)

    Thanks
     
    mantodeus, Jan 6, 2008 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    you can do it just by simple echo

    <?php

    echo " <html> <head > <title> Hello world </title> </head>";
    echo "<body>";
    echo "<h1> HELLLLOOOOOOOOO </H1>";

    echo " <a href=\"http://www.google.com\"> This is a link </a> ";

    ?>

    etc ...
     
    commandos, Jan 6, 2008 IP
  3. mantodeus

    mantodeus Active Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    Thank you very much

    If I want to add whole page written on HTML I must type echo every time or ?
     
    mantodeus, Jan 6, 2008 IP
  4. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #4
    no


    echo <<<END

    HTML CODES

    END;
     
    commandos, Jan 6, 2008 IP
  5. Javof

    Javof Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    include 'blq.html';
    blq.html - Can be anywhere

    For instance:
    include '/files/html/blq.html';
     
    Javof, Jan 6, 2008 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    You can integrate PHP+HTML with no need of echo, print or include/require:

    
    <?php
    
    //Calculations
    
    //PHP code
    ?>
    <!-- Regular html code, javascript code or flash -->
    
    <?php
    
    //More php code if needed
    
    ?>
    
    PHP:
    PHP pages are treated just like HTML pages, but anything found between <?php * ?> is sent to php compiler and returns HTML code.

    Peace,
     
    Barti1987, Jan 6, 2008 IP
  7. mantodeus

    mantodeus Active Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    At first moment (before I even post thread) I try this and didn't work.After that this worked but the code was displayed in the beginning of the page :) I want to be in the middle.Now I tried for 3 time and now everything is ok.Thank you very much for help.
     
    mantodeus, Jan 6, 2008 IP