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/27 18:03:22 UTC

Still struggling with templates...

Hello,
I would like to have a <title> tag defined in my app main/root template
(Layout.tml) and ensure that in each of the *.tml files that use that
template or one of its sub-templates, the content of the title is replaced
by an appropriate value.

I have tried using the xmlns:p="tapestry:parameter" to no avail. Should I
use *t:content* instead?

Can anyone please advise?
Regards,
Julien.

Re: Still struggling with templates...

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 27 Jan 2012 16:48:20 -0200, Josh Canfield <jo...@gmail.com>  
wrote:

> Take a look here:
> http://jumpstart.doublenegative.com.au/jumpstart/previews/withlayout/helloworld
> It has an example of passing text to the layout as a parameter.

In addition, JumpStart also has a nice example of blocks and Delegate:  
http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/delegateandblocks.  
The other thing you'll use is the getBlockParameter(String name) method of  
ComponentResources (which you get by @Inject'ion) or just declare it as a  
parameter of type Block. Here's the "else" parameter declaration in the If  
component, for example:

@Parameter(name = "else", defaultPrefix = BindingConstants.LITERAL)
private Block elseBlock;

-- 
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: Still struggling with templates...

Posted by Josh Canfield <jo...@gmail.com>.
Take a look here:

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

It has an example of passing text to the layout as a parameter.

Josh

On Fri, Jan 27, 2012 at 9:03 AM, Julien Martin <ba...@gmail.com> wrote:
> Hello,
> I would like to have a <title> tag defined in my app main/root template
> (Layout.tml) and ensure that in each of the *.tml files that use that
> template or one of its sub-templates, the content of the title is replaced
> by an appropriate value.
>
> I have tried using the xmlns:p="tapestry:parameter" to no avail. Should I
> use *t:content* instead?
>
> 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: Still struggling with templates...

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 27 Jan 2012 15:03:22 -0200, Julien Martin <ba...@gmail.com> wrote:

> Hello,

Hi!

> I would like to have a <title> tag defined in my app main/root template
> (Layout.tml) and ensure that in each of the *.tml files that use that
> template or one of its sub-templates, the content of the title is  
> replaced by an appropriate value.

For this specific scenario wouldn't it be better and easier to just add  
<title>${title}</title> and @Parameter private String title; in your  
layout?

> I have tried using the xmlns:p="tapestry:parameter" to no avail.

What exactly happened? Could you please post your template and class?  
Without them, we cannot help, just guess.

> Should I use *t:content* instead?

Absolutely no. You need to use blocks and block parameters.

-- 
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