In a velocity template, having called #initslot, and then opened up a #foreach loop to interate through the slots, is it then possible to pull out the template with which that slot was linked to the content item. To be a bit more specific:
What I’m thinking is that there must be some sort of built in function I can execute on $relresult to get the template. I’ve had a look through the docs we have, but can’t find anything.
$relresult is an object of type IPSAssemblyResult. You will see that this interface has a “getTemplate()” method. In Velocity, $relresult.getTemplate() is exactly that same as $relresult.template.
I realize that Javadoc is a bit hard for non-programmers to read, but there’s a wealth of information about how to access Objects within the server in those pages.
The PSO toolkit has it’s own Javadoc which is useful if you use methods from the toolkit this is located at:
I am a programmer and I have been using Java for over 10 years. The problem is making the conversion from java to Velocity. Is there a magic decoder ring somewhere that translates the java method getTemplate() into the velocity shortcut .template? I ask because this information is not provided in any documentation (in a concise or complete manner) or the Java Docs.
The whole “methods as properties” convention comes from the JSP Expression Language, which formalized this concept around Java Beans. Since all beans which have a “foo” property will implement the method getFoo(), the reference to the property just calls the getter method.
Velocity, JEXL and other such languages just follow suit here. This certainly could be clearer: we initially decided that trying to re-write the Velocity documentation would amount to “boiling the ocean”. Perhaps we were wrong and there needs to be better documentation from the Velocity end.