There are basically three ways to call 'sub-routines' :
1. Write your own tag. probably a bit overkill.
2. Put the sub-routine into a separate script and include it several times. Problem with this is that the script has to live in a file on the server somewhere and you have to mess around with hard-coded paths in your script.
3. Use the jelly:define taglib, not included with standard clarity. Its here :
jelly:define I do not understand why this is not included in the standard Clarity distribution, as it really is a gem. It basically allows you to write your own tags using jelly itself, for example:
<define:taglib uri="foo">
<define:tag name="bar">
<gel:out>You passed in : ${var1} and ${id}</gel:out>
<gel:out>the grand old duke of york, he had ten thousand men</gel:out>
</define:tag>
</define:taglib>
<foo:bar var="test" id="1234" />
Notice that you can pass in attributes to your tag, in my example 'var' and 'id', and you can use them inside the tag as variables ${var} and ${id}. I'm not going to tell you all it can do, thats what I get paid for :) Besides, its all in the documentation.
/Mark