This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Custom template tag (like {literal})...

Custom template tag (like {literal}) possible?

Custom template tag (like {literal}) possible?

Thursday 23 June 2011 12:10:00 pm - 2 replies

Hi, there,

I'm thinking about building a CoffeeScript-extension which should allow you to add CoffeeScript in templates between {coffee}…{/coffee} tags. While compiling the template, the CoffeeScript should also be compiled to JavaScript and stored as JavaScript in the compiled template.

I looked around the eztemplate classes but found no real starting point. (Are there .ini-settings needed? Autoloads? etc.)

Any hints?




Thursday 23 June 2011 1:30:55 pm

Nope, eztemplate is black magic when it comes to these things, as it's two separate code paths for compiled and interpreted mode.
If you survive to tell the tale we'll buy you a cookie happy.gif Emoticon
But! Template-blocks are hardcoded into the parsers, so it is AFAIK not something you can extend from extensions. So if I where you I would try to go another route on this one, at least until we have changed our template engine to something else.

Thursday 23 June 2011 10:13:23 pm

Well one way to do it would be to create a custom template operator to which you will pass the CoffeScript code, and which will then generate the desired output.

P.S. In case you wondered, strings in eZP template can be multiline.


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from