Share » Forums » Developer » Creating a function within a tpl file

Creating a function within a tpl file

Creating a function within a tpl file

Monday 28 December 2009 9:17:47 am - 1 reply

Author Message

Gaetano Giunta

Monday 28 December 2009 1:36:44 pm

The correct way to do it: create a template operator. It is about the only php code there is a RAD-generator for in the admin interface, and half a bazillion template operator extensions to take as examples.

The hackish way: separate your "function" code in a separate template, and use the {include uri='design:myfunction.tpl' vari1=$v1 var2=$v2} operator as if it was a function call. To get the value back in a variable, you will have to define said variable before the inclusion of the function-template (or use appropriately variable scopes, but it might be hard)

Principal Consultant International Business
Member of the Community Project Board

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

36 542 Users on board!

Forums menu