Women in Technology

Hear us Roar

  The Dynamic Duo of PEAR::DB and Smarty
Subject:   This is not separating logic from presentation
Date:   2003-04-23 19:59:26
From:   jcpm
Response to: This is not separating logic from presentation

As I said in the article, presentation logic is very different from business logic. I see nothing wrong with allowing the designer or programmer to separate the logic in which a row gets a different color, for instance.

From personal experience, having presentation logic in the PHP code eventually gets confusing and messy. Why should I have to loop through blocks as it is done in PHPLIB just to set a placeholder to have the color #CCCCCC or #999999.

But most of all, this is personal opinion. Templating systems should be chosen by what you feel comfortable using, and some people may prefer Smarty and some people may prefer PHPLIB or some other system.

Joao Prado Maia

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • This is not separating logic from presentation
    2003-04-25 00:55:18  anonymous2 [View]

    The problem is not in the template engines but in the way programmer use them.

    The presented example is very clear that in the end it will always be the same person doing the presentation and the logic. This means that if you want to alter the logic, you need to alter the presentation templates.

    Consequently, it will be more expensive to companies that work that way because it has all to be done by a single person that needs to know 3 languages: PHP, HTML and the template engine language.

    For people that deal with that, it may be just fine, but people with that many qualifications are harder to find, charge more and stall the development more because all the work is dependent on them.

    Bottom line, messing three languages to use a template engine is a very inneficient and expensive way of work. Only people that work alone have an hard time understanding this.
    • This is not separating logic from presentation
      2003-07-29 02:26:04  anonymous2 [View]

      >This means that if you want to alter the logic, you need to alter the presentation templates.
      Not true. You still do not see the difference between the two logics involved. when you do a script that needs a template you write the code on the script, then you pass the needed vars to smarty. if you change the original code as much as to have the necessity of changing the logic on the template is your own fault - that may occur because you didnīt thought well of the use of that script.
      anyway, letīs say that your boss says you "ok, now change it because I'm a big kick4ss". you have to change the script and the template. but you would also need to do it if you embed the html on the script making the task much harder.
      @about template syntax for html coders
      if you know to code on HTML you certainly can understand how to use {if (something)}foo{/if} or maybe {section loop...}. that two functions, plus literal and comments {* are the most I use. I think that it is not precissely about learning assembler...