I have 5 templates. Two Templates call One that, in turn, call the other two depending from which template it was called from.
I want to do the following:
<template name="Template1">
<!-- show his things -->
{{BaseTemplate SubTemplate1}}
</template>
<template name="Template2">
<!-- show his things -->
{{BaseTemplate SubTemplate2}}
</template>
<template name="BaseTemplate">
{{#each xpto}}
<!-- show base things -->
{{BaseTemplate {{CallSubTemplateGiven}} }}
{{/each}}
</template>
<template name="SubTemplate1">
<!-- show few things -->
</template>
<template name="SubTemplate2">
<!-- show other things -->
</template>
Is there a way to do it? Could not figure out how to do it with RegisterHelper.
You should be able to do it by passing the sub template as an argument to the base template, and then using template.dynamic to render the right one.
<template name="Template1">
{{> BaseTemplate subtemplate=SubTemplate1 }}
</template>
<template name="Template2">
{{> BaseTemplate subtemplate=SubTemplate2 }}
</template>
<template name="BaseTemplate">
{{#each xpto}}
{{> Template.dynamic template=../subtemplate }}
{{/each}}
</template>
<template name="SubTemplate1">
</template>
<template name="SubTemplate2">
</template>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments