AEM直观地如何重用变量 [英] AEM sightly how to reuse variables
问题描述
我可以在要包含的另一个文件中使用变量吗?
can I use variables in another file that I'm including?
在我的HTL中(file1.html),我有:
in my HTL (file1.html) I have:
<sly data-sly-test.myVar="${properties.myVarFromDialog}"></sly>
<sly data-sly-include="/file2.html"></sly>
我可以在file2.html中使用myVar吗?我没有任何价值。有没有办法从file1.html获取该值以在file2.html中使用
Can I use myVar in file2.html ? I'm not getting any value. Is there a way of getting that value from file1.html to use in file2.html
推荐答案
您应该使用data-sly-模板。您可以在单独的文件中定义模板,并且可以传入参数。有关模板的说明,请检查以下文档链接
http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html#template
You should use data-sly-template for this. You can define templates in a separate file and can pass in parameters. For an explanation on templates check the following documentation link http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html#template
这篇关于AEM直观地如何重用变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!