带有瓷砖的嵌套模板 [英] Nested templates with tiles

查看:281
本文介绍了带有瓷砖的嵌套模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拥有一些带有磁贴的嵌套模板,但是暂时没有任何运气.

I want to have some nested templates with tiles, but without any luck for the moment.

我的主模板:

[...]
<div id=body><tiles:insertAttribute name="body"/></div>
[...]

我的嵌套模板:

[...]
<div id=sub><tiles:insertAttribute name="sub"/></div>
[...]

我的视图定义:

<tiles-definitions>
    <definition name="mainTemplate" template="/mainTemplate.jspx">
    </definition>
    <definition extends="mainTemplate" name="subTemplate">
        <put-attribute name="body" value="/subTemplate.jspx"/>
    </definition>
    <definition extends="mainTemplate" name="myView">
        <put-attribute name="sub" value="blablabla"/>
    </definition>
</tiles-definitions>

我所期望的:

<div id=body><div id=sub>blablabla</div></div>

我得到了什么:

<div id=body><div id=sub></div></div>

我在磁贴网站上看到了文档这个主题,但我不能使它起作用:(

I have seen the documentation on the tiles website about this subject but I can't make it work :(

推荐答案

实际上,"subTemplate"和"myView"是扩展"mainTemplate"的两个不同定义.据我了解,您希望将"myView"图块嵌套在"subTemplate"图块中.

Actually, "subTemplate" and "myView" are two different definitions extending "mainTemplate" both. From what I understand you want the"myView" tile to be nested inside the "subTemplate" tile.

您可以尝试这样的事情:

You could try something like this :

<tiles-definitions>
    <definition name="mainTemplate" template="/mainTemplate.jspx">
    <definition name="subTemplate" extends="mainTemplate">
        <put-attribute name="body">
            <definition template="/subTemplate.jspx">
                <put-attribute name="myView" value="blablabla" />
            </definition>
        </put-attribute>
     </definition>
</tiles-definition>

这篇关于带有瓷砖的嵌套模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆