[geeklog-devel] caching template library
tony at tonybibbs.com
Thu Nov 1 14:25:17 EDT 2007
This is similar to Flexy/Smarty with one
important difference for Geeklog: in Flexy, calling htmlspecialchars is
the default and you can only prevent its call with :h. Geeklog outputs
HTML deep in its core and converting an existing template to be Flexy
compatible would mean adding in lots of :h's. With my modification to
PHPlib, the assumption is reversed and that means little to no core
I hear you, I agree mostly with everything which has to be shocking for even you given we don't see eye-to-eye at all. Much of the inefficiencies of the current PHPLib is the fact it doesn't support looping and basic IF logic. The result is we have a ton of tiny templates which could go away and we get back the I/O required to open/close then open/close, etc. So yes, what I am suggesting is a wholesale switch which would require significant code changes. That doesn't bother me because of what you get in the end.
And as far as escaping output by default, that is a requirement in my opinion. I don't care how many :h's you do...when you do a :h (or whatever syntax it is) you have to ask yourself hey, do I really want to allow HTML/JS, etc? It errors on the side of security...another GL trait.
As for the lang stuff...happy will be the day that $LANG01 goes away complete for something actually readable. But if we get the template thing licked I can hold off on that complaint.
Done and done. Simple control structures would be easy to add but I
didn't want anyone saying I'd done too much to the lib. The cost for
these changes is more and more regexs when the template is cached. Once
cached these things have zero additional cost. But if someone wanted
for and if in there, I can add them in a few days (after I return from
vacation). I know. Why roll our own when there are libraries like
Smarty and Flexy? Well, not having to rewrite every "new Template" call
in Geeklog has far greater value than you attach to it, I think.
Joe trust me if anybody here knows how much work it would be ti's me...after all I'm the on that took the original GL codebase and implemented PHPLib in the first place. What do we have, like half a dozen active developers? This isn't rocket science or difficult work...it's some grepping, search/replace, test over-and-over for a few weeks. As long as it is coordinated I'd have no problem even doing that brainless work as long as we end up in the right place. Also, don't forget the ability to call functions...not being able to do that is a real f'n pain.
Don't get me wrong, I know how much work it is. Our stuff has a lot of history and that history brings a resistance to change. I still feel the 1.x codebase is clean but when you open up Drupal/Joomla/etc some of which have undergone this *very* task I'm sure they'll tell you it was worth it.
It's a matter of When not If this happens. To me this is a question of being lazy and taking the easy route or biting the bullet and reaping the benefits.
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net
More information about the geeklog-devel