Forums / Developer / Functions in templates

Functions in templates

Author Message

Tristan Koen

Thursday 12 June 2003 1:59:03 am

It is possible to write functions in templates? For example, if one wishes to display a table with curved corners, it must be done using a set of images for the border. It would be nice to have a function that would generate the necessary output instead of having to type it over and over again within the template.
Better yet, could some of these functions be made global (i.e. accessible by more than a single template).

I suppose the above could be achieved using custom tags, but is there another way?

Bård Farstad

Thursday 12 June 2003 3:00:36 am

This can be done with a custom tag, i.e. just a special template. You can also change the template for the standard tables, or add a "classification".

The classification is a way to define a special variation of a tag. E.g. <table class="product_info"> which will be used to render the product_info tables with a custom template.

You can also extend the template engine with a function or an operator which will render this table.

The best solution will be dependant on how complex the tables are. An override template is the quickest solution.

--bård

Documentation: http://ez.no/doc