Re: T5: Best page templating strategy
This could also be written as: Block onBeforeRenderBody() { return _sidebar; } On 4/10/07, Yann Ramin <[EMAIL PROTECTED]> wrote: Just figured out you can return the block in a render stage to get it to render. Deceptively simple, but the docs (from my reading), didn't mention it. @BeforeRenderBody Block doSidebar() { return _sidebar; } Yann Ramin wrote: > I got a good start on this, but still missing something fundamental. > > In Page.java, I have the Sidebar component. > In Page.html, I pass the component in a parameter > > > > > In Layout.java I have a sidebar block > > @Parameter(required=true) > private Block _sidebar; > > What I can't figure out is how to get the block to render. > > Thanks for all of your suggestions so far! > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Best page templating strategy
Just figured out you can return the block in a render stage to get it to render. Deceptively simple, but the docs (from my reading), didn't mention it. @BeforeRenderBody Block doSidebar() { return _sidebar; } Yann Ramin wrote: I got a good start on this, but still missing something fundamental. In Page.java, I have the Sidebar component. In Page.html, I pass the component in a parameter In Layout.java I have a sidebar block @Parameter(required=true) private Block _sidebar; What I can't figure out is how to get the block to render. Thanks for all of your suggestions so far! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Best page templating strategy
I got a good start on this, but still missing something fundamental. In Page.java, I have the Sidebar component. In Page.html, I pass the component in a parameter In Layout.java I have a sidebar block @Parameter(required=true) private Block _sidebar; What I can't figure out is how to get the block to render. Thanks for all of your suggestions so far! Howard Lewis Ship wrote: If the sidebar really changes for each page, then it can be a Block parameter to the layout component. This will allow the layout component to control where, within its templates, the sidebar appears. Check out the t:parameter documentation. On 4/10/07, Stephane PAQUET <[EMAIL PROTECTED]> wrote: Just one question, why don't you use a CSS layout + ASSET in stead of component (this does not apply to the sidebar). Rgds, SP On Apr 10, 2007, at 8:28 AM, Yann Ramin wrote: > I'm using T5 to do some experimental testing, creating some mockup > applications to teach me more about the framework. > > My question is, how do you best handle multi-part layouts? > > For instance, a Layout can be composed of a Body and a Sidebar. The > Sidebar can be a component. > > My current approach is to have a > > Page.java: > > public Page { > @Component > private Layout _layout; > @Component > private Sidebar _sidebar; > } > > Page.html: > > > > fee fi fo fum > > > > > This feels suboptimal, as I'm encoding the location of the sidebar > into each and every page (namely always coming after the main div). > I'd like to have the Sidebar component in the Layout component, but > feed this component from the Page to the Layout (as the Sidebar > component could be different on every page). I.e., sidebar="sidebar">, but that is a parameter, not a component, so > afaik won't work like I expect it to (it didn't in testing, but > could have been anything). > > Any way of accomplishing this? Any better solutions to this > problem? Am I missing something? > > > BTW, T5 is a great framework - having lots of fun with it! > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Best page templating strategy
If the sidebar really changes for each page, then it can be a Block parameter to the layout component. This will allow the layout component to control where, within its templates, the sidebar appears. Check out the t:parameter documentation. On 4/10/07, Stephane PAQUET <[EMAIL PROTECTED]> wrote: Just one question, why don't you use a CSS layout + ASSET in stead of component (this does not apply to the sidebar). Rgds, SP On Apr 10, 2007, at 8:28 AM, Yann Ramin wrote: > I'm using T5 to do some experimental testing, creating some mockup > applications to teach me more about the framework. > > My question is, how do you best handle multi-part layouts? > > For instance, a Layout can be composed of a Body and a Sidebar. The > Sidebar can be a component. > > My current approach is to have a > > Page.java: > > public Page { > @Component > private Layout _layout; > @Component > private Sidebar _sidebar; > } > > Page.html: > > > > fee fi fo fum > > > > > This feels suboptimal, as I'm encoding the location of the sidebar > into each and every page (namely always coming after the main div). > I'd like to have the Sidebar component in the Layout component, but > feed this component from the Page to the Layout (as the Sidebar > component could be different on every page). I.e., sidebar="sidebar">, but that is a parameter, not a component, so > afaik won't work like I expect it to (it didn't in testing, but > could have been anything). > > Any way of accomplishing this? Any better solutions to this > problem? Am I missing something? > > > BTW, T5 is a great framework - having lots of fun with it! > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Best page templating strategy
Just one question, why don't you use a CSS layout + ASSET in stead of component (this does not apply to the sidebar). Rgds, SP On Apr 10, 2007, at 8:28 AM, Yann Ramin wrote: I'm using T5 to do some experimental testing, creating some mockup applications to teach me more about the framework. My question is, how do you best handle multi-part layouts? For instance, a Layout can be composed of a Body and a Sidebar. The Sidebar can be a component. My current approach is to have a Page.java: public Page { @Component private Layout _layout; @Component private Sidebar _sidebar; } Page.html: fee fi fo fum This feels suboptimal, as I'm encoding the location of the sidebar into each and every page (namely always coming after the main div). I'd like to have the Sidebar component in the Layout component, but feed this component from the Page to the Layout (as the Sidebar component could be different on every page). I.e., sidebar="sidebar">, but that is a parameter, not a component, so afaik won't work like I expect it to (it didn't in testing, but could have been anything). Any way of accomplishing this? Any better solutions to this problem? Am I missing something? BTW, T5 is a great framework - having lots of fun with it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]