My Database functions are all wrapped up in an easy to use class.  The
methods look something like this:

$db = new DB;
$q = "SELECT * FROM ATable";
$db->query($q);
while ($db->next_record()) {
     $db->p("SomethingOrOther");
}

For the PHP script itself, the content management system I wrote up uses
case statements in a single file engine and multple includes.

for example:

switch($func) {
    case("news"):
         include("/news/news.inc");
         break;
}

and news.inc may contain:

switch($task) {
    case("add"):
        include("/news/news.add.inc");
       break;
    case("del"):
        include("/news/news.del.inc");
       break;
   default:
       include("/news/news.view.inc");
}

and then each would contain the actual code.  It worked really well for a
couple of reasons.  For starts all the includes started as requires for
testing purposes.  If I edited several files but maybe didn't test them all,
it'll will kick out any parse errors or warnings -- also useful since I've
got another person working with me.  Then when the site went live, I changed
them to includes (well actually had to change a bunch of them part way
through when I ran out of memory *s*).

Also the code is very modular.  I know what each file does and so does my
partner who isn't a php programmer but may need to edit the HTML portions a
little. Each file is clearly named as its its funciton so he knows where to
look if there is a problem with a pages appearance.

Joel



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to