You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lu Mudong <mu...@hotmail.com> on 2010/11/29 01:08:45 UTC

How to extend a parent template

Hello, list,
I am pretty new to tapestry. I am trying to figure out how to extend a parent template, all the googling and tutorials didn't help.
All the examples I found extend a parent template like below:
<t:extend xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">  ......</t:extend>
Let's say I have a parent template named base.tml,  I want the child template homepage.tml to extend base.tml, how is the child template homepage.tml supposed to know what its parent template is? 
thanks,
Ron


 		 	   		  

Re: How to extend a parent template

Posted by Geoff Callender <ge...@gmail.com>.
The link http://jumpstart.doublenegative.com.au/jumpstart/examples/layoutwithmenu/page1
has been replaced by:

	http://jumpstart.doublenegative.com.au/jumpstart/previews/withlayout/helloworld

and for more about components try:

	http://jumpstart.doublenegative.com.au/jumpstart/examples/component/crud/persons

On 29/11/2010, at 11:49 AM, Paul Stanton wrote:

> Hi Ron,
> 
> In tapestry you need to think of a 'template' as a 'component'. Components don't 'extend' each other, however they can be included within one another.
> 
> Components can be made flexible enough so that they can defer sections to their containing component via parameters or the body (<t:body />) component.
> 
> These might help you understand the concept.
> 
> http://tapestry.apache.org/layout-component.html
> http://jumpstart.doublenegative.com.au/jumpstart/examples/layoutwithmenu/page1
> 
> p.
> 
> On 29/11/2010 11:08 AM, Lu Mudong wrote:
>> Hello, list,
>> I am pretty new to tapestry. I am trying to figure out how to extend a parent template, all the googling and tutorials didn't help.
>> All the examples I found extend a parent template like below:
>> <t:extend xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">   ......</t:extend>
>> Let's say I have a parent template named base.tml,  I want the child template homepage.tml to extend base.tml, how is the child template homepage.tml supposed to know what its parent template is?
>> thanks,
>> Ron
>> 
>> 
>>  		 	   		
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to extend a parent template

Posted by Paul Stanton <pa...@mapshed.com.au>.
Hi Ron,

In tapestry you need to think of a 'template' as a 'component'. 
Components don't 'extend' each other, however they can be included 
within one another.

Components can be made flexible enough so that they can defer sections 
to their containing component via parameters or the body (<t:body />) 
component.

These might help you understand the concept.

http://tapestry.apache.org/layout-component.html
http://jumpstart.doublenegative.com.au/jumpstart/examples/layoutwithmenu/page1

p.

On 29/11/2010 11:08 AM, Lu Mudong wrote:
> Hello, list,
> I am pretty new to tapestry. I am trying to figure out how to extend a parent template, all the googling and tutorials didn't help.
> All the examples I found extend a parent template like below:
> <t:extend xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">   ......</t:extend>
> Let's say I have a parent template named base.tml,  I want the child template homepage.tml to extend base.tml, how is the child template homepage.tml supposed to know what its parent template is?
> thanks,
> Ron
>
>
>   		 	   		

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: How to extend a parent template

Posted by Lu Mudong <mu...@hotmail.com>.
Thanks, guys, now I understand. I think I need to dig more on this. At least at the moment, Django's approach seems more flexible to me  
Ron

> Date: Sun, 28 Nov 2010 21:47:04 -0800
> Subject: Re: How to extend a parent template
> From: joshcanfield@gmail.com
> To: users@tapestry.apache.org
> 
> http://tapestry.apache.org/tapestry5.1/guide/templates.html
> 
> Look at the template inheritance section.
> 
> In general you should choose composition over inheritance, but if you want
> to have a base class for your pages there is a way to inherit and extend a
> templates.
> 
> What you might want to investigate is the layout pattern. You create a
> component that renders the main layout and then individual pages add the
> content. There is an example in the maven archetype.
> On 28 Nov 2010 16:09, "Lu Mudong" <mu...@hotmail.com> wrote:
 		 	   		  

Re: How to extend a parent template

Posted by Josh Canfield <jo...@gmail.com>.
http://tapestry.apache.org/tapestry5.1/guide/templates.html

Look at the template inheritance section.

In general you should choose composition over inheritance, but if you want
to have a base class for your pages there is a way to inherit and extend a
templates.

What you might want to investigate is the layout pattern. You create a
component that renders the main layout and then individual pages add the
content. There is an example in the maven archetype.
On 28 Nov 2010 16:09, "Lu Mudong" <mu...@hotmail.com> wrote: