Re: [PHP3] scalable design, content separation and modules From: Aidan Skinner (aidan <email protected>)
Date: 02/20/00

Chris writes:
 
> On Sun, Feb 20, 2000 at 01:10:33AM +0000, Aidan Skinner wrote:

> language-neutral interface for networked applications). Do you think that
> this would be going a bit overboard as far as abstraction goes? My original

Removing content from logic is a Good Thing, and is the right way to
do things.

Are you familiar with the Model-Control-Viewer model from Smalltalk 80?

This seperates the three parts nicely:

The model is the content.
The controller is the logic.
The viewer is the presentation/layout.

The viewer asks the controller to do something to the model, and
displays the results.

The controller manipulates the model in the various necessary ways.

The model is passive, and reacts to the controller and gives it's
information to the viewer on request.

> XML-RPC. A couple questions on that: would it slow things down too much to
> use the XML-RPC interface exclusively for content interaction (even the

I think it's probably over kill, unless there's another reason for it
(such as other apps parsing the data and it can't be stored in a database).

> > I would *strongly* reccomend the design patterns book (assuming it's
> > the one by Gamma et al). It's *excellent*.
> >
> Yep, that's the one. It looks like one of the books in my order is out of
> stock, so it may be a while before the books arrive...

It's not an introduction to OO programming, and assumes your familiar
with the concepts of inheritence, abstraction and polymorphism, so
look elsewhere if you're new to this stuff. However, if you're looking
for intelligent ways to do stuff, and ways to make your life easier
it's really good.

> I usually half-ass this portion of the design. Broken CSS implementations
> on different browsers tend to mangle whatever I try to define. 'Course,

There's a basic level of compatability between IE and NS and Mozilla
which allows you to do enough to live with. It's still not great, but
we live in a world of brokenness. :(

> separated, though. Writing out the HTML from within the logic modules seems like a
> somewhat hackish way to go about writing a scalable site, especially if
> non-programmers would need to maintain parts of the site. Any suggestions
> for this?

Templates, or put what the designers need to call inside functions and
let them call that.

Eg:

<table>
 <?php draw_this_table() ?>
</table>

> which means that each portion of a site has an index page where a big switch
> statement evaluates request headers and calls various module methods based on that.
> So, I just include() the module files in the index page.

Of course...

Hmm, a cleaner way might be to do this:

<?php
  if (!$this_module) {
    $this_module = TRUE:

    class foo {};
  }

?>

So that things are defined only once...

- Aidan (a programmer of very little brain)

-- 
http://www.skinner.demon.co.uk/aidan/
Currently looking for work: CV available on request.

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>