Women in Technology

Hear us Roar



Article:
  The Dynamic Duo of PEAR::DB and Smarty
Subject:   This is not separating logic from presentation
Date:   2003-04-23 10:09:22
From:   anonymous2
Response to: This is not separating logic from presentation

There is more than one type of logic. The idea behind templates is to remove business logic from your presentation. Not to remove presentation logic from your presentation. There is a bunch of logic that has every right to be in the templates - such as alternating table row colors, theme selection, special messages, etc. This has nothing to do with the business logic or data access. Try this:


http://www.massassi.com/php/template_engines/

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • This is not separating logic from presentation
    2003-04-23 17:18:23  anonymous2 [View]

    No, you are not getting the point. Any logic flow control should not be in the templates because this simply rules out that majority of the real presentation designers.

    If you need to iterate over the same template, like in alternating table row colors, just do it in the programming. That is what programming is meant to be, control the program output logic flow.

    Template engines like Smarty that make you handle any logic in the templates are not a great improvement over the traditional PHP programming. They require you to learn a third language that is neither PHP nor HTML.

    Properly conceived templates should only contain HTML, placeholders and delimiters, so they can be edited in any HTML editor and any good graphic designer can do his job and not have to learn that third language.