[geeklog-devel] caching template library

Joe Mucchiello jmucchiello at yahoo.com
Sat Nov 3 00:18:42 EDT 2007


At 09:58 AM 11/2/2007, Tony Bibbs wrote:
> 1) Lots of little templates is a big problem.  In order to adjust the
> layout for a specific page you have to touch a bunch of little files.
> Having as much of the HTML in as few files as possible make
> maintenance easier.  Even though you may reduce some of the I/O you
> are still stat'ing each time you need one and because of how this is
> put together opcode caching with something like APC won't help you at
> all.

Stat'ing does not happen unless a call to clearstatcache() is made
between includes.

And I have said, Geeklog does not take enough advantage of the
set_block function. It allows you to have repeating sections inside a
file. For example, list.thtml and listitem.thtml should be just one
file:

---list.thtml---
<ul {list_class}>
{list_items}
</ul>
----------------

---listitem.thtml---
  <li>{list_item}</li>
--------------------

---Combined file---
<ul {list_class}>
<!-- BEGIN list_item -->
  <li>{list_item}</li>
<!-- END list_item -->
</ul>
--------------------

There you go. One less file. There's lots of places where that should
be done in the current code. ADMIN_list could be done with one template
file using set_block. Instead it takes up 5-6 files.


> 2) The fact you say escaping output is meaningless concerns me A LOT.


That's a bit out of context. I was saying that based on how Geeklog is
constructed, EVERY variable would end up with :h on it. And that is why
the result (of switching or not switching to Flexy/Smarty) is
meaningless. Heck, there are $LANG entries with HTML in them. You can't
pass them through htmlspecialchars with breaking the HTML. There are
lots of variables where the "output" is a full <A> link.

> 3) I don't condone putting a lot of PHP code in templates.  Simple
> loops, IF's and handy method calls is all you need.  This is surely a
> philosophical thing with you so it's pointless to debate (is as much
> of the discussion between you and I).

Actually, I'm arguing that loops and ifs aren't needed either. But
still I don't fear PHP code in templates. If something like a loop is
necessary, then coding directly in PHP is also more efficient. This
also deals with your support issue. If you don't provide looping in
your template library, you have no code to support.

And as for pointless debate: this is open source - Vive la difference.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the geeklog-devel mailing list