rocker
rocker copied to clipboard
nested templates
I try to call a optional nested templates like
@with (templateName = model.getNestedTemplateName("SAMPLE") {
@if (null != templateName) {
@Rocker.template(templateName, model)
}
}
My model contains a method
public String getNestedTemplateName(final String componentName)
{
if ("SAMPLE".equals(componentName)) {
return (SampleTemplate.getTemplatePackageName().replace(".", "/") + "/" + SampleTemplate.getTemplateName());
}
return null;
}
this is quite lengthy.. Is it possible to add a method "getFullTemplateName" which returns the complete name to the generated templates?
Thanks Jens
What prevents you from calling the template directly?
@import package.SampleTemplate
@args(...)
@SampleTemplate.template(model)
I'm curious, what's your use case for having templates that could not exist?