> Let's be honest, XSL is is one big logic step itself -- moreover it's a
> whole other language to learn.

<ramble>
I wouldn't call it a _big_ step. It only looks big when you look down.
8-)

I would tend rather to encourage the use of XSL, myself.  If you can
pick up php okay, you ought to have few problems with XSL. (My biggest
problem with XSL is remembering to let the application language handle
the hard logic. Don't try to calculate the company budget in XSL, except
as a logic game to amuse yourself while riding the train home.)

You have your data in the database, and a filter (ergo, PHP code) to
extract the data, dress it up a bit and add XML tags. Then you have an
XSL filter to munge the XML into HTML. And the nice thing about XSL is
that the web page layout is all determined by the XSL. 

Of course, it does work out to be a bit messier than it sounds, but the
benefits are definite.

To the OP -- don't focus on the code, don't focus on the coding style
either, focus on the problem. The object is not to avoid mixing PHP and
HTML, and the object is not to use (or not use) objects. Rather, it is
to separate processes that are more related to the business side of
things from processes that are more related to the presentation side. 

My comments on XSL aside, you can program both business and presentation
in PHP. HTML will mostly be in the presentation side, but not
necessarily always. For instance, on the business side, you may
sometimes want to provide a table of the projected monthly profits for
the next year as a complete table wrapped in tags, rather than providing
the raw numbers to the presentation side.

If the design is in someone else's hands, you'll want a template engine.
The basic concept is that the designer designs the template, putting
template tags in where the data should go. The presentation code picks
up the data and the template, replaces the tags with the data, and spits
the result out at the viewer's browser. 

Some template engines are better at actually conforming to that model
than others (particualarly in relation to your app), and XSL can
definitely be used in ways that don't conform to that model. That's no
big deal, just part of what makes life interesting. 

(And if you get into Javaland, you'll hear a lot about MVC and
frameworks. That's a slightly more refined, uhm, model.)
</ramble>

-- 
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to