[thelist] PHP Organization

Pete Freitag pf at cfdev.com
Wed Jul 10 14:12:01 CDT 2002


You could look at Fusebox...

http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/Fusebox/page1.html

http://www.fusebox.org

_____________________________________________
Pete Freitag
CTO, CFDEV.COM
ColdFusion Tags, Products, and Free Resources
http://www.cfdev.com/

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Beau Hartshorne
Sent: Wednesday, July 10, 2002 2:43 PM
To: thelist
Subject: [thelist] PHP Organization


Hi,

I'm trying to figure out a good way to organize all of my .php code. I'd
also like to find a good way to write it so that it's easy to
understand, and then modify later.

Until now, I've kept most of my code in large files. It doesn't take
long before this gets really messy, then later hard to read and modify.
Part of this massive file would have some code that printed out a form,
some code that checked the form's contents once it was submitted, and
some code to insert this information in a database.

Instead, I'd like to keep smaller chunks of code seperated in different
.php files, and use one "brain" .php file per major section (product
catalogue, contact, etc) to figure out which of the smaller .php files
to include. I think a good way to organize this would be to keep
separate directories for each section, and keep all of the .php files
that are unique to that section in their directory. The "brain" .php
file would be the index.php file inside whatever directory. So, the
directory structure would look something like this:

/index.php
/contact/index.php
/contact/print_contact-form.php
/contact/check_contact-form.php
/contact/update_contact-database.php
/products/index.php
/products/show_catalogue.php
/products/show_item.php

etc...

There will probably be a few things that the entire app would need
access to. They could be kept in a /global directory.

Another advantage is that you could code links like this:
<http://www.foo.com/bar/> instead of: <http://www.foo.com/bar.php>.

Does anyone see any potential problems with this structure? Can anyone
make any suggestions to make it better?

Thank you,

Beau


--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list