Alternatively, if different pages need different blocks, you can declare a parameter to your layout of type "block":

Layout.java:
@Parameter(requred=true)
@Property
private Block customBlock;

Layout.tml

<t:delegate to="customBlock"/>

Page.tml:

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd " xmlns:p="tapestry:parameter">
<t:layout>
  <p:customBlock>
Here is my custom, page-specific content that will be rendered wherever the layout deems fit.
  </p:customBlock>
</t:layout>
</t:container>

Otherwise, if all pages use the same markup, put the block inside of Layout.tml, as Thiago suggested.

Robert

On May 11, 2010, at 5/119:20 AM , Thiago H. de Paula Figueiredo wrote:

On Tue, 11 May 2010 11:09:29 -0300, Thomas Cucchietti <thomas.cucchie...@gmail.com > wrote:

Hi Thiago,

Hi!

I can't declare it into my page as I'm using it in the Layout component and not in a page.

In this case, you can declare the blocks in Layout itself. Take a look at http://tapestry.apache.org/tapestry5.1/cookbook/switch.html to see an example of using blocks and Delegate.

Actually, I should declare the different templates (Blocks) in my
Layout.tml. I don't like it very much as the templates may be quite
numerous.... But it seems that I don't have other possibilities.

You could do that too.

For the easier way, I knew this one : efficient but I don't know why, I feel it quite dirty :p

It's not dirty. Tapestry is just trading off a little convenience for more performance and way less memory use than JSF, for example.

--
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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



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

Reply via email to