[consulting] Challenging an Assumption About What an Easy tpl.php Looks Like

Greg Holsclaw greg at t2media.com
Mon Oct 12 03:05:53 UTC 2009


I think when you factor in the perspective of whom may be making the
changes, the question of 'easier to read' may change.
 
With the full PHP version I think it is less clear where non-geek HTML
designers should make the changes, since it is all PHP code.
 
In the HTML with PHP mixed, at least it is clear that the designer should
make any changes inside the <?php . ?> regions, while there fewer clear
indicators where HTML updates should be make, or how to visually find them.
 
As an aside, the indenting of the HTML by DIV level is lost in the full PHP
version which I think designers were feel keenly.
 
Also the difference between single and double quotes may be lost of a
designer, as well as escaping characters (if needed).
 
My 2 cents of course.
 
Greg
 
From: consulting-bounces at drupal.org [mailto:consulting-bounces at drupal.org]
On Behalf Of Shai Gluskin
Sent: Sunday, October 11, 2009 7:47 PM
To: A list for Drupal consultants and Drupal service/hosting providers
Subject: [consulting] Challenging an Assumption About What an Easy tpl.php
Looks Like
 
Gang,

Every tpl.php file that I've seen in any theme is written in html with php
interspersed for putting in variables. I think part of the reasoning for
this approach is that it would be easier for non-geek designers to read such
pages.

I want to challenge that. I think all those php open-close and all the
"print" commands makes for very hard-to-read code. Tonight, as an
experiment, I rewrote the node.tpl.php file from Zen from html to php. I
think it is a lot easier to read. And it's sure a lot easier to comment.

I pasted my rewritten version and the original from Zen onto a pastebin:
http://pastebin.ca/1614186

Anyway, I'd be curious what other's opinions are on this.

best,

Shai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/consulting/attachments/20091011/712757b0/attachment-0001.html 


More information about the consulting mailing list