Weeelll... it's possible to do everything you want. Yes, you can have
your cake and eat it, too. ;) But it comes at the cost of complexity one
way or another.
So, right now, I have a project that has two different layouts. For this
project, which layout to use was very well defined, so I simply defined
three border components. Yes, three. ;) One is the one that the pages
use. It, in turn, wraps the other two border components, rendering
whichever one is appropriate for the situation. So, you have something like:
<span jwcid="@base:If" condition="ognl:condition" element="ognl:null">
<body jwcid="@border1">
  <div jwcid="@RenderBody"/>
</body>
</span>
</span jwcid="@base:Else" element="ognl:null">
<body jwcid="@border2">
  <div jwcid="@RenderBody"/>
</body>
</span>

But, what happens if your needs are more complex? (Like the top + side
menu) I've also implemented a system for border which would support any
number of layouts, without knowing a thing about the other layouts ahead
of time. The trick here, or at least the one that I used, was my good
friends block and render block.

It's been awhile since I looked at this setup, but the general idea was
that each page was wrapped by the border component, but the border used
block/render block to delegate the rendering to the unknown layouts.
So, it's something like:

<body jwcid="@Body">

<div jwcid="@RenderBlock" block="ognl:layoutBlock"
mainContent="ognl:components.bodyContent"/>

<!-- important piece... :) -->

<div jwcid="[EMAIL PROTECTED]">
  <div jwcid="@RenderBody"/>
</div>

Notice how the render body is, itself, in a block.
The individual layouts then do something like:

<div jwcid="[EMAIL PROTECTED]">
<!-- various markup for the individual layout -->
<!-- now insert the body -->
<div jwcid="@RenderBlock"
block="ognl:components.layout1.inserter.bindings.mainContent.object"/>
</div>

It's a bit twisted and demented... but it works. ;)
Happy tapestry'ing.

Robert

Vinicius Carvalho wrote:
> Thanks to Ron and Jamie I got things started here with composite
> screens. Well But I found it most ackward to have a component called
> Border with my page layout. What if I have diferent layouts, should I
> create a new component for each one? What about nesting? Imagine a
> page that has a menu on top and content underneath. Ok here's my
> component:
> <tr>
> <td> some menu</<td>
> <td>@RenderBody</td>
> <tr>
> 
> Ok, now what happens is let's say one of the itens of the menu has
> another composite page with a menu on the left? How to compose them?
> 
> thanks all
> 
> Vinicius
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to