You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julien Martin <ba...@gmail.com> on 2012/01/22 23:04:21 UTC

t:container vs t:content?

Hello,
I have read the documentation and have had a look into code samples and I
am still trying to figure out the difference between *t:container* and *
t:content*.
Can anyone please advise?
Regards,
Julien.

Re: t:container vs t:content?

Posted by Julien Martin <ba...@gmail.com>.
Josh,
Thanks. I'll take a look at it then.
Regards,
Julien.

2012/1/23 Josh Canfield <jo...@gmail.com>

> I believe the quickstart app has a layout that does exactly this with
> the sidebar content.
>
>
> On Mon, Jan 23, 2012 at 2:02 AM, Julien Martin <ba...@gmail.com> wrote:
> > Thanks Josh,
> >
> > What I am not sure about is whether I can have a template/layout
> specifying
> > several portions of code that will be replaced as follows (similarly to
> > what you get with facelets templates).
> >
> > from layout.tml:
> > *<html  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">*
> > *<head></head>*
> > *<body>*
> > *Welcome to my website.*
> > *<t:part1/>*
> > *some more content*
> > *<t:part2/>*
> > *</body>*
> > *</html>*
> >
> > from the template that is going to use the layout:
> > *<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd
> ">*
> > *<t:part1>*
> > *Hello; this is part1 implementation.*
> > *</t:part1>*
> > *
> > *
> > *<t:part2>*
> > *Hello; this is part2 implementation.*
> > *</t:part2>*
> > *</t:layout>*
> >
> >
> >
> > 2012/1/23 Josh Canfield <jo...@gmail.com>
> >
> >> From the docs: http://tapestry.apache.org/component-templates.html
> >> A <t:container> element contains markup without being considered part
> >> of the template.
> >>
> >> <t:content> marks a portion of the template as the actual template
> >> content; any markup outside the <t:content> element is ignored.
> >>
> >> t:container must be the root element. It allows you to create a valid
> >> xml document when a component would want to render multiple roots,
> >> such as in the example from the docs where the component renders <td>
> >> elements which can't be wrapped with any html.
> >>
> >> t:container predates t:content, and you could use t:content for the
> >> same purpose, but <t:content> is also a handy way to write component
> >> templates that are complete html files without including all that html
> >> in your rendered page.
> >>
> >> <html>
> >>  <head>
> >>    <title>My Search Component</title>
> >>  </head>
> >>  <body>
> >>    <h1>Search Component Preview</h1>
> >>    <!-- Only the stuff in <t:content> is rendered with the component -->
> >>    <t:content>
> >>      <form>...<input /></form>
> >>    </t:content>
> >>  </body>
> >> </html>
> >>
> >> Josh
> >>
> >> On Sun, Jan 22, 2012 at 2:04 PM, Julien Martin <ba...@gmail.com>
> wrote:
> >> > Hello,
> >> > I have read the documentation and have had a look into code samples
> and I
> >> > am still trying to figure out the difference between *t:container*
> and *
> >> > t:content*.
> >> > Can anyone please advise?
> >> > Regards,
> >> > Julien.
> >>
> >> ---------------------------------------------------------------------
> >> 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: t:container vs t:content?

Posted by Josh Canfield <jo...@gmail.com>.
I believe the quickstart app has a layout that does exactly this with
the sidebar content.


On Mon, Jan 23, 2012 at 2:02 AM, Julien Martin <ba...@gmail.com> wrote:
> Thanks Josh,
>
> What I am not sure about is whether I can have a template/layout specifying
> several portions of code that will be replaced as follows (similarly to
> what you get with facelets templates).
>
> from layout.tml:
> *<html  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">*
> *<head></head>*
> *<body>*
> *Welcome to my website.*
> *<t:part1/>*
> *some more content*
> *<t:part2/>*
> *</body>*
> *</html>*
>
> from the template that is going to use the layout:
> *<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">*
> *<t:part1>*
> *Hello; this is part1 implementation.*
> *</t:part1>*
> *
> *
> *<t:part2>*
> *Hello; this is part2 implementation.*
> *</t:part2>*
> *</t:layout>*
>
>
>
> 2012/1/23 Josh Canfield <jo...@gmail.com>
>
>> From the docs: http://tapestry.apache.org/component-templates.html
>> A <t:container> element contains markup without being considered part
>> of the template.
>>
>> <t:content> marks a portion of the template as the actual template
>> content; any markup outside the <t:content> element is ignored.
>>
>> t:container must be the root element. It allows you to create a valid
>> xml document when a component would want to render multiple roots,
>> such as in the example from the docs where the component renders <td>
>> elements which can't be wrapped with any html.
>>
>> t:container predates t:content, and you could use t:content for the
>> same purpose, but <t:content> is also a handy way to write component
>> templates that are complete html files without including all that html
>> in your rendered page.
>>
>> <html>
>>  <head>
>>    <title>My Search Component</title>
>>  </head>
>>  <body>
>>    <h1>Search Component Preview</h1>
>>    <!-- Only the stuff in <t:content> is rendered with the component -->
>>    <t:content>
>>      <form>...<input /></form>
>>    </t:content>
>>  </body>
>> </html>
>>
>> Josh
>>
>> On Sun, Jan 22, 2012 at 2:04 PM, Julien Martin <ba...@gmail.com> wrote:
>> > Hello,
>> > I have read the documentation and have had a look into code samples and I
>> > am still trying to figure out the difference between *t:container* and *
>> > t:content*.
>> > Can anyone please advise?
>> > Regards,
>> > Julien.
>>
>> ---------------------------------------------------------------------
>> 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: t:container vs t:content?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 23 Jan 2012 08:02:54 -0200, Julien Martin <ba...@gmail.com> wrote:

> What I am not sure about is whether I can have a template/layout  
> specifying
> several portions of code that will be replaced as follows (similarly to
> what you get with facelets templates).

You can, but you'll need block parameters for that (@Parameter private  
Block header, for example). Use <t:body> for the main part and <p:xxx> for  
the others. To render a block, use the Delegate component.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: t:container vs t:content?

Posted by Julien Martin <ba...@gmail.com>.
Thanks Josh,

What I am not sure about is whether I can have a template/layout specifying
several portions of code that will be replaced as follows (similarly to
what you get with facelets templates).

from layout.tml:
*<html  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">*
*<head></head>*
*<body>*
*Welcome to my website.*
*<t:part1/>*
*some more content*
*<t:part2/>*
*</body>*
*</html>*

from the template that is going to use the layout:
*<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">*
*<t:part1>*
*Hello; this is part1 implementation.*
*</t:part1>*
*
*
*<t:part2>*
*Hello; this is part2 implementation.*
*</t:part2>*
*</t:layout>*



2012/1/23 Josh Canfield <jo...@gmail.com>

> From the docs: http://tapestry.apache.org/component-templates.html
> A <t:container> element contains markup without being considered part
> of the template.
>
> <t:content> marks a portion of the template as the actual template
> content; any markup outside the <t:content> element is ignored.
>
> t:container must be the root element. It allows you to create a valid
> xml document when a component would want to render multiple roots,
> such as in the example from the docs where the component renders <td>
> elements which can't be wrapped with any html.
>
> t:container predates t:content, and you could use t:content for the
> same purpose, but <t:content> is also a handy way to write component
> templates that are complete html files without including all that html
> in your rendered page.
>
> <html>
>  <head>
>    <title>My Search Component</title>
>  </head>
>  <body>
>    <h1>Search Component Preview</h1>
>    <!-- Only the stuff in <t:content> is rendered with the component -->
>    <t:content>
>      <form>...<input /></form>
>    </t:content>
>  </body>
> </html>
>
> Josh
>
> On Sun, Jan 22, 2012 at 2:04 PM, Julien Martin <ba...@gmail.com> wrote:
> > Hello,
> > I have read the documentation and have had a look into code samples and I
> > am still trying to figure out the difference between *t:container* and *
> > t:content*.
> > Can anyone please advise?
> > Regards,
> > Julien.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: t:container vs t:content?

Posted by Josh Canfield <jo...@gmail.com>.
>From the docs: http://tapestry.apache.org/component-templates.html
A <t:container> element contains markup without being considered part
of the template.

<t:content> marks a portion of the template as the actual template
content; any markup outside the <t:content> element is ignored.

t:container must be the root element. It allows you to create a valid
xml document when a component would want to render multiple roots,
such as in the example from the docs where the component renders <td>
elements which can't be wrapped with any html.

t:container predates t:content, and you could use t:content for the
same purpose, but <t:content> is also a handy way to write component
templates that are complete html files without including all that html
in your rendered page.

<html>
  <head>
    <title>My Search Component</title>
  </head>
  <body>
    <h1>Search Component Preview</h1>
    <!-- Only the stuff in <t:content> is rendered with the component -->
    <t:content>
      <form>...<input /></form>
    </t:content>
  </body>
</html>

Josh

On Sun, Jan 22, 2012 at 2:04 PM, Julien Martin <ba...@gmail.com> wrote:
> Hello,
> I have read the documentation and have had a look into code samples and I
> am still trying to figure out the difference between *t:container* and *
> t:content*.
> Can anyone please advise?
> Regards,
> Julien.

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