You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Eric Cuendet <je...@rptec.ch> on 2006/06/13 15:39:33 UTC

Order of rendering components

Hi,
While creating a FAQ page, I made a component that takes a Title + a 
Body, then render it with a counter in the page for the FAQ number. 
Adding a FAQ is as simple as writing:
   <span jwcid="@FaqIten" title="The title">
   This is the body of this FAQ item
   </span>

But then I'd like a FAQ summary, taking all titles of all the FaqItems 
and put them at the *beginning* of the page. So each FaqItem would 
register its title in a collection in the page and then the FaqSummary 
component take that collection and render it as a Summary.
My problem is how to make the FaqSummary render itself *after* all the 
FaqItem are rendered?

Thanks
-jec

-- 
Best regards / Salutations.

Jean-Eric Cuendet
Senior developer / Technical support
Riskpro Technologies SA
Av. Louis-Ruchonnet 2
CH-1003 Lausanne
Switzerland

Direct    : +41 21 637 0123
Principal : +41 21 637 0110
Fax       : +41 21 637 0111
Skype     : jec.rptec
Web       : http://www.rptec.ch
--------------------------------------------------------

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


Re: Order of rendering components

Posted by Jean-Eric Cuendet <je...@rptec.ch>.
> - enumerating all FaqItem components in the page (or in the body of 
> FaqSummary), and getting the title values from their parameters?
>  This solution is somewhat easier to implement if you do not need fully 
> flexible component hierarchy (I mean for example FaqItems are rendered 
> from multiple pages).

This is indeed a good solution! Could you send me a snippet of code for 
enumerating all FaqItems?
Thanks
-jec


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


Re: Order of rendering components

Posted by Norbert Sándor <de...@erinors.com>.
First my q: couldn't you use an easier solution?

For example:
- enumerating all FaqItem components in the page (or in the body of 
FaqSummary), and getting the title values from their parameters?
  This solution is somewhat easier to implement if you do not need fully 
flexible component hierarchy (I mean for example FaqItems are rendered 
from multiple pages).
- if data of FaqItems come from a database, you can use the same query 
to fill the FaqSummary
- etc :)

Regards,
Norbi

Regards,
Norbi

Jean-Eric Cuendet wrote:
>
>> In such advanced cases you can use IMarkupWriter.getNestedWriter():
>> When rendering the page:
>> - render all FaqItems to a nested writer
>> - render the FaqSummary itself
>> - close() the nested writer (which implicitly commits its content to 
>> the main writer)
>
> Thanks a lot, that makes sense.
> But where do I put what?
>
> I'll have something like:
>
> <span jwcid="@FaqSummary"/>
>
> <span jwcid="@FaqItem" title="title1">
> Body of FAQ #1
> </span>
>
> <span jwcid="@FaqItem" title="title2">
> Body of FAQ #2
> </span>
>
> Where do I put the Nested thing?
> -jec
>
>
>
>
> ---------------------------------------------------------------------
> 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: Order of rendering components

Posted by Jean-Eric Cuendet <je...@rptec.ch>.
> In such advanced cases you can use IMarkupWriter.getNestedWriter():
> When rendering the page:
> - render all FaqItems to a nested writer
> - render the FaqSummary itself
> - close() the nested writer (which implicitly commits its content to the 
> main writer)

Thanks a lot, that makes sense.
But where do I put what?

I'll have something like:

<span jwcid="@FaqSummary"/>

<span jwcid="@FaqItem" title="title1">
Body of FAQ #1
</span>

<span jwcid="@FaqItem" title="title2">
Body of FAQ #2
</span>

Where do I put the Nested thing?
-jec




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


Re: Order of rendering components

Posted by Norbert Sándor <de...@erinors.com>.
In such advanced cases you can use IMarkupWriter.getNestedWriter():
When rendering the page:
- render all FaqItems to a nested writer
- render the FaqSummary itself
- close() the nested writer (which implicitly commits its content to the 
main writer)

Regards,
Norbert Sándor

Jean-Eric Cuendet wrote:
> Hi,
> While creating a FAQ page, I made a component that takes a Title + a 
> Body, then render it with a counter in the page for the FAQ number. 
> Adding a FAQ is as simple as writing:
>   <span jwcid="@FaqIten" title="The title">
>   This is the body of this FAQ item
>   </span>
>
> But then I'd like a FAQ summary, taking all titles of all the FaqItems 
> and put them at the *beginning* of the page. So each FaqItem would 
> register its title in a collection in the page and then the FaqSummary 
> component take that collection and render it as a Summary.
> My problem is how to make the FaqSummary render itself *after* all the 
> FaqItem are rendered?
>
> Thanks
> -jec
>

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