|
Posted by Sanders Kaufman on 08/29/07 19:08
Adam Baker wrote:
> This is a fairly broad question. I have looked for web sites or books
> on the topic, by to no avail.
>
> I'm creating a fairly small web site in which the content is drawn
> from an XML file (more or less as an exercise, but also so that it can
> be maintained easily).
>
> I've got a first-level page and five second-level pages.
>
> One way I'm trying it is to keep a single XML file, and two PHP files,
> one for the first level page and one for the second-level page. That
> makes pretty clunky content generation.
>
> The second option is to have a different PHP file for each second
> level page. Less elegant in one respect, but the individual PHP files
> are much simpler.
>
> This is a small example, but I'm curious whether people have
> experience with larger applications, and at what point they felt the
> PHP got intractable.
My framework (and I guest that of most folks) does pretty much the same
thing.
The way I did it was to create a database class (bvckvs_database()) that
does all the DB interaction.
Then I have an abstract baseclass (bvckvs_baseclass()) that aggregates
the database class. It defines a few properties that are specific to
tables, but not to any one table.
Finally I have the class I actually use (bvckvs_publication) that
EXTENDS the base class. That class is used to build the web pages, and
gets its data through the other tiers. I create the same "publication"
class for each web page, but by simply changing the title, it auto-loads
all of the data for that specific publication.
In tiered terms - Database->Business Logic->User Interface.
That's an architectural structure that I learned from Microsoft's
"Solutions Architecutres" courses. It's not the way everybody does it,
but it works pretty darned well for me... and Bill.
[Back to original message]
|