Reputation: 170
I have a question about Tapestry pages and templates.
A user send request to get a page. I recognize the request comes from mobile or desktop. I want to show a requested page with different layout.
For instance:
If the request comes from mobile device I want to load mobileLayout.tml and pages/mobile/index.tml, that index.tml have t:type="mobilelayout".
If it comes from desktop device I want to load layout.tml and pages/index.tml, that index.tml have t:type="layout".
Example:
Show page pages/index.tml only for Desktop devices.
Show page pages/mobile/index.tml only for Mobile devices.
I want to load mobileLayout and pages/mobile/index.tml
Requested page: /index
Basically for mobile devices I want to get content from pages/mobile otherwise from pages/.
Is something like that possible in Tapestry5(5.3.6)?
I have tried something like below, but without success:
LayoutLoader.tml - There I recognise where the request comes from.
<t:delegate to="layout" />
<t:block t:id="mobileLayout">
<t:mobileLayout />
</t:block>
<t:block t:id="desktopLayout">
<t:layout />
</t:block>
components/Layout.tml
<body t:type="layoutloader">...</body>
components/MobileLayout.tml
<body t:type="layoutloader">...</body>
pages/Index.tml
<div t:type="layout">...</div>
pages/mobile/Index.tml
<div t:type="mobileLayout">...</div>
Upvotes: 1
Views: 776
Reputation: 27994
You might find Igor's blog post interesting http://blog.tapestry5.de/index.php/2011/06/24/template-skinning/
Upvotes: 1