Share » Forums » Developer » Custom Template Operators

Custom Template Operators

Custom Template Operators

Tuesday 04 December 2007 1:24:34 pm - 2 replies

Author Message

Paul Leclercq

Tuesday 04 December 2007 3:05:34 pm

Hiya Jough,

Try this page:
http://ez.no/fr/ezpublish/documentation/development/extensions/template_operator

It is a good simple exemple for hello world.

Basically, an operator is a function which can be used in your template:

You will find a list of the pre-built operators here:
http://ez.no/doc/ez_publish/technical_manual/3_10/reference/template_operators

To use your operator in the template once created you simply need to do something like:
{def $my_variable = my_operator('my_parameter1', 'my_parameter2')}

You can then display you result
like this:
{$my_variable} or {$my_variable|attribute(show)} if you are returning an array

As explained in the above hello world exemple: you will need to create your operator in the
/extension folder
you will need to tell the system that you have an operator in the
extension/myextension/settings/site.ini.append

And place your extension in the folder:
extension/myextension/autoloads

Once you have created your extension don't forget to activate it by going to the administration interface -> setup -> extensions -> tick and activate -> clear cache

Let us know how you get on!

Jough Dempsey

Monday 10 December 2007 1:38:48 pm

Thank you for your reply, Paul. It helped a lot, although I found that I could do the simple search that I needed to with the built-in fetch template functions (after a fashion).

Jough Dempsey
Senior Developer
D U O : C O N S U L T I N G
Web Content Management Experts
http://www.duoconsulting.com

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

36 542 Users on board!

Forums menu