#native_company# #native_desc#

PHP-HTML Templates: A New Working Relationship

By PHP Builder Staff
on April 3, 2002

By Wee Lep
From preface of the PHP manual, the following states the definition
of PHP scripting: “PHP is an HTML-embedded scripting language.
… The goal of the language is to allow web developers to write
dynamically generated pages quickly.”
The phrase “HTML-embedded scripting language” reminds me of my days
in “dot-coms” (“dot-gones” for now). I was involved in the development
of corporate portal sites. My working counterparts were mainly
webpage and graphic designers with little or no programming knowledge.
Since PHP is a “HTML-embedded scripting language”, so it becomes
natural to embed my PHP codes in the web pages designed by the
designer folks. Often, I will have to embed PHP codes in HTML pages
to dynamically display the records which I retrieved from database(es).
Take an “Address Book” application for example. We normally store the address book entries : “Name” and “Address” in database. :
|   NAME  |         Address       |
|  Alvin  | Block 112 Bedok Road  |
|  Robert | 23 Livingstone Road   |
|   John  | 556 Everton Park Road |
When the time comes to display them in HTML pages, we will normally insert our PHP codes in the HTML page like this :
    <td> <b>Name</b></td>
    <td> <b>Address</b></td>
     ..... database extraction codes (omitted) .... 
     for ($row_nbr=0; $row_nbr < $NUMBER_OF_RECORDS; $row_nbr++)
        echo "<tr>n";
        echo "<td> " . $recordset_array[$row_nbr][0] . " </b></td>n";
        echo "<td> " . $recordset_array[$row_nbr][1] . " </b></td>n";        
        echo "</tr>n";