9 comments
developercast.com » Brian Moon’s Blog: Says:
[...] Moon points out a simple PHP templating application shown to him - Blitz: A coworker of mine found out about a [...]
Alexey Rybak Says:
>>But why the need to write a new parser for this with a completely different syntax
Modern applications have very complex presentation logic. We want HTML/JS guys to keep their hands off the presentation logic - we do know what happens otherwise. We want to separate HTML and view logic. We want to see the code, with no HTML/Smarty/PHP/Whatever spaghetti mess. We want to work with the code. Well, that is a some king of philosophy. You just feel this - or not :)))
>>there are a lot of sites where serving up the templates is the bottle neck
You are right. We are talking about a very small amount of projects: big and highload. Big enough to have problems while trying to manage PHP spaghetti with a small team which doesn't want to grow - to be smart and agile. Highload enough to have tuned as much as possible finished with CPU on php-frontends being well not bottleneck but one of very important degrees of freedom.
Richard Heyes Says:
All template systems are shite imo. require or include do just a good a job, and sepeparate out the logic and presentation. Oh and they're as fast as you can get too.
Marc Gear Says:
"all template systems are shite" is a bit of a wild generalisation Richard...
I'll agree with most systems that offer a different syntax to PHP (like smarty) are not really worth using unless you are using user input as templates (and therefore want to restrict the functionality) as they have a severe performance cost. However Blitz was 3x as fast as a regular PHP include in the the simple render test.
Blitz seems like a really good option if you need a template language to deal with user-customisable pages.
Arnold Daniels Says:
PHP essentially is a templating language (Value: ), so creating a templating language in a templating language never seemed logical to me. The main reason you here is you want to restrict functionality, which seems valid.
But why the need to write a new parser for this with a completely different syntax. This doesn't make the process easier for the user which write the templates. They most likely already know PHP. Creating an extension which does an include but restricts the use of functions and variables seems like a much nicer solution a much more fruitful way to spend your time, to me.
Doing performance test really seems useless to me, because I don't think there are a lot of sites where serving up the templates is the bottle neck. You see times as 0.0003 seconds (the last example isn't real world), where the whole HTTP request handling, is measured in terms of 0.01 seconds.
To conclude separation of concerns is a good idea, but why not write the templates in PHP.
kajal Says:
Hi , I am trying to mail Richard Heyes but always it get bounce, so please anybody can tell me right mail id, I want to ask him about php template class, It's very urgent, please reply vaery soon.
Comments are disabled for this post.
Viktoras Agejevas Says:
You can check out my templating solution for PHP5, it is based on include and plain PHP is used in templates. Still in development, but it is worth a look: http://fry.sourceforge.com