Template engine

9 views
Skip to first unread message

darkredz

unread,
May 19, 2009, 1:32:01 PM5/19/09
to Recess PHP Framework
If I may put my two cents in, it would be cool to integrate some sort
of easy to view template engine for Recess, something like what Django
template syntax? It's nice to the eyes for the HTML authoring teams

Can you have a look at this if you got the chance Kris? http://www.h2o-template.org/
Cheers.

Jamie Rumbelow

unread,
May 19, 2009, 1:39:35 PM5/19/09
to recess-f...@googlegroups.com
Recess can easily be integrated with Smarty, the popular PHP
templating engine, and it's really easy to use others. Check out the
$template_engine (I think) variable in the config file. Please note
that in the next major update of Recess there will be a new template
engine currently being worked on.

Jamie

darkredz

unread,
May 19, 2009, 1:43:51 PM5/19/09
to Recess PHP Framework
on second thought, something like 'annotation' for views in the HTML
templates would fit Recess nicely.
Something that we can define a loop block using comments in the view,
say:

<!-- BEGIN goods_list -->
<tr>
<td>{{product}}</td>
<td>{{price}}</td>
<td>{{location}}</td>
</tr>
<!-- END goods_list -->

that would make the whole HTML template clean and nice, since comments
are not rendered on most modern browsers, Plus it's really familiar to
HTML designers and it can be opened in Dreamweaver and being viewed
correctly. Instead of those <? ?> or some {% %} which will break the
whole design of the HTML page when viewed without being processed by
PHP

Joshua Paine

unread,
May 19, 2009, 3:04:01 PM5/19/09
to recess-f...@googlegroups.com
On Tue, 2009-05-19 at 10:43 -0700, darkredz wrote:
> on second thought, something like 'annotation' for views in the HTML
> templates would fit Recess nicely.
> Something that we can define a loop block using comments in the view,
> say:
> <!-- BEGIN goods_list -->

There are already a quazillion template engines, and the "simple" one
you start making either becomes complicated when you have to make it do
everything people need or else it quickly becomes useless.

As Jamie mentioned, smarty is already supported, and adding support for
others shouldn't be hard.

The other, in-re-development option is RecessView, which is basically
just some output buffer helpers/sugar together with inline PHP. It's
faster to execute than most templating options, and there's almost
nothing to learn if you already know PHP.

Unfortunately it's not well documented or quite nailed-down yet. We're
working on it.

--
Joshua Paine
LetterBlock: Web applications built with joy
http://letterblock.com/
301-576-1920

darkredz

unread,
May 19, 2009, 10:45:40 PM5/19/09
to Recess PHP Framework
Oh, that's a great news to me. I would look more into RecessView.
By the way, I am not asking about feature bloated templates(like
Smarty) which makes no point to me since I might as well use inline
PHP together.
Just bringing in some concepts from some older php_templates syntax
since <!-- --> would fit up a nice valid HTML which is DTD validity
friendly (good for our fellow designers)

Anyway I was doing some research and came to a PHP extension which is
really fast compare to typical php based templating system
There's a nice performance benchmarks on the site

http://alexeyrybak.com/blitz/blitz_en.html

http://codelemur.wordpress.com/2007/08/10/php-templating-celebrity-deathmatch/

it too allows alternative tags such as <!--

Joshua Paine

unread,
May 20, 2009, 9:39:01 AM5/20/09
to recess-f...@googlegroups.com
On Tue, 2009-05-19 at 19:45 -0700, darkredz wrote:
> http://alexeyrybak.com/blitz/blitz_en.html

I'm a Recess contributor and user, but I'm not in charge of anything.
That said, I don't see this becoming an official part of the framework.
Supporting a rare compiled extension is probably too much ongoing work
for a project with a goal of easy deployment.

Of course, you're welcome to integrate it yourself. I don't think you'll
find it very hard to do.

darkredz

unread,
May 20, 2009, 10:14:45 AM5/20/09
to Recess PHP Framework
Hey Joshua, I am actually planning to integrate it when I am more
familiar with this framework.

Kris Jordan

unread,
May 20, 2009, 12:16:32 PM5/20/09
to recess-f...@googlegroups.com
The great thing about template engines is that there are a wide variety that suit different situations and styles. Though we're on the topic of HTML template engines, the situation is even more vibrant with varying content-types (i.e. PDF / JSON / PNG "templating" systems).

H20 looks pretty cool.

Two core mantras of Recess are:

1) Batteries included. It should work out of the box. For this reason Recess ships with a default view system (revamped in the upcoming release, as Joshua mentioned)

2) Modularity. If you'd rather work with X templating language than Recess' default it shouldn't be hard to plug-in. The same goes with Models and ORM. There's nothing that closely ties a controller to a model. Or a view to a controller. You could even plug-in a different controller system (a little more challenging to replace than V or M because your FooController must be able to report routing information).

What will be great to see with the next release is a flourishing collection of plugins that sit in the plug-ins directory and simplify the process of using other templating engines like H20 and persistence engines like Doctrine. A further-out release should also open up some hooks for these plugins in Tools that will allow Tools & code generation to produce scaffolding influenced by plugins.

If you need help getting H20 setup as a plugin, let me know!
Reply all
Reply to author
Forward
0 new messages