Re: Re: seperating php code from html?
| From: | Mike Jackson | Date: | Mon, 14 Apr 2003 08:54:28 +0000 |
| Subject: | Re: Re: seperating php code from html? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143729@lists.php.net to get a copy of this message | ||
ext dwalker (dwalker@healthyproductsplus.com) wrote:
> Modularity is also a plus.
Seperating the code is a must if you have other people who will control
the "look and feel" of the application.
I don't seperate all of the html from the code. I have written a set of
libraries that allow me to do rapid application development for LAMP
programs. They generate the html. I include a header.inc and footer.inc
on each page of the application. The page color, etc, are set in the
header.inc file.
To write an html form page with my library, for example:
# ------------------------------------------------------------
<?php
// someform.inc
// form.lib is already included in the flow control script
echo "<h3 align=center>Some Form</h3>";
FormTableOpen($PHP_SELF,"");
echo (MakeTextBox("First Name","firstname","50"));
echo (MakeTextBox("Last Name","lastname","50"));
echo (MakeTextBox("Email Address","email","50"));
echo (MakeTextBox("Mobile Number","mobile","50"));
echo (MakeTextArea("Description","description","20","70"));
SessionStage("task","submit");
SubmitButton("Submit");
FormTableClose();
?>
# ------------------------------------------------------------
I have functions for generating SELECT lists based on SQL queries, etc.
Based on my "application template" (a set of libraries, include files,
and a flow control php script) I can produce a new LAMP application in a
few hours. A "webmaster" could manually insert HTML markup between my
function calls to change the "look and feel" if he wanted to.
This isn't right or wrong; it's just the way I do it.
--
mike