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

Shai Gluskin shai at content2zero.com
Mon Oct 12 02:46:56 UTC 2009


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/025a7f48/attachment-0001.html 


More information about the consulting mailing list