Re: XML over CSS

From: Chris Hope (blackhole_at_electrictoolbox.com)
Date: 07/12/04


Date: Mon, 12 Jul 2004 16:44:51 +1200

Mudge wrote:

> Thank you.  Do you think that generating XML and then using XSL to change
> it into HTML and then using CSS for page layout and display -- do you
> think this makes it easier to separate presentation from business logic
> than just using HTML and CSS?

It depends how you code your PHP. But generally when people code the HTML
output in the PHP you often end up with a lot of HTML and PHP being mixed
up together with database calls in the middle of the HTML output. There's
not necessarily anything wrong with this (and I've done it plenty of times
in the past) but it is nice to separate that stuff from the output. Using
XML/XSL enforces the separation.

There are other methods though, such as using a templated solution like
Smarty (I've never used it myself but seen it mentioned here before).

A lot of your decision really comes down to how much you want to have to
learn. If you choose XML & XSL to do the presentation layer then you're
going to have to learn XSL as well as PHP. An excellent XSL reference book
(if you decide to learn it) is http://tinyurl.com/36jq9

-- 
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/


Relevant Pages

  • Re: "Best" coding practice?
    ... > The goal is not to seperate HTML and PHP, ... Using a loop inside your HTML is not a bad thing, ... MVC to separate presentation logic and bussines logic. ... and stuffing too much into template in order to handle ...
    (alt.php)
  • Re: "Best" coding practice?
    ... > The goal is not to seperate HTML and PHP, ... Using a loop inside your HTML is not a bad thing, ... MVC to separate presentation logic and bussines logic. ... and stuffing too much into template in order to handle ...
    (comp.lang.php)
  • Re: [PHP] About PHP CMS
    ... to keep html separate from php you can also look at XSLT. ... If you're talking about a personal visit counter, run away OOP. ...
    (php.general)
  • Re: [PHP] Separating HTML code from PHP code
    ... the html codes from the php codes (i.e. placing them in separate ... finding it difficult doing that at the moment with php. ... html that has an action targetting itself and upon submission the ...
    (php.general)
  • Re: XML over CSS
    ... >It depends how you code your PHP. ... But generally when people code the HTML ... >in the past) but it is nice to separate that stuff from the output. ... kind of code that you find in programming books. ...
    (comp.lang.php)