Including one Velocity Template into another

Folks:

I have a search from that I want to share between my various Global Templates. It makes no special reference to any rhythmyx objects except by refering to an $rxs_navbase style binding.

What’s the simplest way I can include this template into a spearate Global Template?

I’d rather do this without having to link teh search form template to any content types, slots or anything else in my system.

Here’s a small macro that we use when we need to assemble a snippet of the SAME item in one the current template.

It should work for global templates as well,


#macro(render_item $assemblyItem $snippetName)
#set($calloutTemplate = $sys.asm.findTemplateByName($snippetName))
#set($calloutItem = $assemblyItem.clone())
$calloutItem.setTemplate($calloutTemplate)
#set($resultList = $sys.asm.assemble($user.psoListTools.asList($calloutItem)))
$resultList.get(0).toResultString()
#end

This should work, but I’ve never tried it on a global template. You may have to use the “long form” of $sys.asm.findTemplates() to locate the global template. If it was a “regular” template that you are including in a global, there should be no such restriction.