Antonio,
I think I understood what you meant. I tried to apply the concept to
head.layout and body.content. I must extend both parts for each page and
keep the same overall layout.
Unfortunately, I didn't get the expected result.
Here's the result:[code]
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<link rel="shortcut icon" href='/favicon.ico' />
<link rel="Stylesheet" href="/res/skins/1.css" />
main.layout.pageCSS
<script src="/res/js/utils.js" type="text/javascript"></script>
<script src="/res/js/treeparams.js" type="text/javascript"></script>
<script src="/res/js/AnimTree.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>[/code]
I don't see contents that I defined in "site.index.body.content".
[code]
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="main.layout" template="/tiles/main-layout.jsp">
<put-attribute name="head" value="head.content"/>
<put-attribute name="body" value="body.content"/>
</definition>
<!-- Used by the main layout -->
<definition name="head.content" template="/tiles/head-content.jsp">
<put-attribute name="title" value=""/>
<put-attribute name="pageCSS" value="main.layout.pageCSS"/>
<put-attribute name="pageJS" value=""/>
</definition>
<!-- Used by the main layout -->
<definition name="body.content">
<put-attribute name="content"
value="/tiles/content-layout.jsp"/>
</definition>
<definition name="site.index.head.content" extends="head.content">
<put-attribute name="title" value="DHTML Kitchen"/>
<put-attribute name="pageCSS" value="/res/css/pages/index.css"/>
</definition>
<definition name="site.index.body.content" extends="body.content">
<put-attribute name="content" value="/index-content.jsp"/>
</definition>
</tiles-definitions>
[/code]
main-layout.jsp
[code]
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%-- Template "head" will have attributes:
title
pageCSS
pageJS
--%>
<tiles:insertAttribute name="head"/>
</head>
<body>
<tiles:insertAttribute name="body"/>
</body>
</html>
[/code]
head-content.jsp
[code]
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<title><tiles:getAsString name="title"/></title>
<link rel="shortcut icon" href='/favicon.ico' />
<link rel="Stylesheet" href="/res/skins/1.css" />
<tiles:getAsString name="pageCSS"/>
<tiles:getAsString name="pageJS"/>
<script src="/res/js/utils.js" type="text/javascript"></script>
<script src="/res/js/treeparams.js" type="text/javascript"></script>
<script src="/res/js/AnimTree.js" type="text/javascript"></script>
[/code]
body-content.jsp
[code]
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<div id="contents">
<tiles:insertAttribute name="content" />
<tiles:insertAttribute name="footer" />
</div>
[/code]
index-content.jsp
[code]
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertDefinition name="site.index.body.content"/>
[/code]
Observations:
* It looks like name="pageCSS" value="main.layout.pageCSS" should have been
overridden, but was not.
* It seems pointless to have a definition for "site.index.body.content" and
then a 1-line invocation.
Is it clear what I am trying to do? What should I change?
Please advise.
Thank you,
Garrett
--
View this message in context:
http://www.nabble.com/Tiles-2.0%3A-pass-thru-attributes--tf3729931.html#a10447891
Sent from the tiles users mailing list archive at Nabble.com.