You can have one layout wrapping another component, like a menu or a sidebar. Of course they are declared into separeted .html's. Then, into the Layout component you can 'call' the other components, like this call to an existing Menu component into your workspace:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <head> <title> &{title}</title> <link href="${layoutCSS}" rel="stylesheet" type="text/css"/> </head> <body> <table width="100%" height="100%" border="0"> <tr> <td valign="top" height="100%"> <t:menu/> <!-- this is the default for calling any component --> </td> </tr> <tr> <td valign="top" height="100%"> <t:body>Page content goes here.</t:body> </td> </tr> </table> </body> </html> and under src/main/resources/org/example/myapp/components you must declare the Menu.html file just like this: <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <a t:type="PageLink" page="foo">FOO</a> </html> and the menu will be inserted on the location declared inside the Layout component. I'm not sure if you have to create a Menu.java too, but i ever do. here you can also specify multiple templates, but the difference, at least in this example, is that you have a 'main' wrapper that define the 'face' of you app by a default call (t:body/>) and explicit calls to specified components. Is that what you meant? 2007/8/23, Angelo Chen <[EMAIL PROTECTED]>: > > > Hi Marcelo, > > This works, thanks. Is this documented in T5 site? > > The difference between this(Border?) and Tiles is, in Tiles layout you can > specify multiple JSPs, T5's border can have only one, but you can have one > after the other. so the syntax is: > > <t:file name> > </t:file name> > > right? > > > > > > Marcelo lotif wrote: > > > > If this help, try to follow my example above: > > > > create a class under src/main/java/org/example/myapp/components called > > Layout.java, for example. Now we put a css stylesheet and a title, just > to > > illustrate: > > > > public class Layout { > > > > @Inject > > @Path("context:assets/css/layout.css") > > private Asset layoutCSS; > > > > private String title = "Some Title"; > > > > public Asset getLayoutCSS() { > > return layoutCSS; > > } > > > > public String getTitle() { > > return title; > > } > > > > } > > > > now, create a template under > > src/main/resources/org/example/myapp/components > > with the same name (i.e. Layout.html): > > > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> > > <head> > > <title>&{title}</title> > > <link href="${layoutCSS}" rel="stylesheet" type="text/css"/> > > </head> > > <body> > > <table width="100%" height="100%" border="0"> > > <tr> > > <td valign="top" height="100%"> > > <t:body>Page content goes here.</t:body> > > </td> > > </tr> > > </table> > > </body> > > </html> > > > > let the Start.html use this template as it's base adding this lines to > it: > > > > <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd > "> > > <!-- put the rest of the page here --> > > </t:layout> > > > > and you're done! > > very simple! :) > > > > 2007/8/22, Anton Gavazuk <[EMAIL PROTECTED]>: > >> > >> Hi Angelo, > >> I had the same question and as I understood - you have to write your > own > >> custom component > >> see > >> http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html > >> and now I try to implement this - if you are interested - we can > >> communicate > >> about the topic and create some kind of howto... > >> > >> 2007/8/22, Angelo Chen <[EMAIL PROTECTED] >: > >> > > >> > > >> > Hi, > >> > > >> > Is there a way to do something like Struts with Tiles in Tapestry 5? > >> > samples? Thanks. > >> > > >> > A.C. > >> > -- > >> > View this message in context: > >> > http://www.nabble.com/T5%3ATiles--tf4310807.html#a12272065 > >> > Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] > >> > > >> > > >> > > > > > > > > -- > > Atenciosamente, > > Marcelo Lotif > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3ATiles--tf4310807.html#a12291330 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Atenciosamente, Marcelo Lotif