You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alex Kwan <er...@hotmail.com> on 2004/03/18 03:07:45 UTC

How to set the template for a component or page dynamically?

Hi, All
    The more work I have done with Tapestry, The more I found that the real
resuable part of the component are specification and classes of these
components. Every web apps will has their own look and feel, so the html
templates are hard to reuse. So I wonder, can we set the template as a
paramter to a component?
    Any suggestion will be appreciated.

Alex

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


Re: How to set the template for a component or page dynamically?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 17, 2004, at 9:27 PM, Alex Kwan wrote:
> Hi Erik,
>     I just want to let the component user be able to set the template 
> for
> the component just as easily as set a paramemter.
>     For example:
>     Compoent Foo has a parameter named template
>     so I just use it like this
>     <component id="foo" type="Foo">
>         <binding name="template" expression="assets.fooTemplate">
>     </compoent>
>
>     That's what I want, Can we archieve this easily in Tapestry?

Easily?  Not currently.  But Tapestry is extremely dynamic and 
pluggable.  You can key off the engine and control where templates come 
from, or use ITemplateSourceDelegate.  It definitely won't work with 
the syntax you proposed (currently).

I'm not in a position to devote much time to contemplate this at the 
moment - maybe others have some ideas?

	Erik


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


Re: How to set the template for a component or page dynamically?

Posted by Alex Kwan <er...@hotmail.com>.
Hi Erik,
    I just want to let the component user be able to set the template for
the component just as easily as set a paramemter.
    For example:
    Compoent Foo has a parameter named template
    so I just use it like this
    <component id="foo" type="Foo">
        <binding name="template" expression="assets.fooTemplate">
    </compoent>

    That's what I want, Can we archieve this easily in Tapestry?

    Thanks alot:)

Alex
----- Original Message ----- 
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, March 18, 2004 10:17 AM
Subject: Re: How to set the template for a component or page dynamically?


> I'm not quite sure of the specifics of your scenario, but a couple of
> brief thoughts:
>
>   - you can override templates.  so if you have a library of components,
> you can override the HTML template by simply putting a the same HTML
> named file into the WEB-INF/classes directory in the right spot.
>
>   - Use ITemplateSourceDelegate and do not include HTML templates into
> your application, and generate them dynamically however you like.
>
> Erik
>
> On Mar 17, 2004, at 9:07 PM, Alex Kwan wrote:
>
> > Hi, All
> >     The more work I have done with Tapestry, The more I found that the
> > real
> > resuable part of the component are specification and classes of these
> > components. Every web apps will has their own look and feel, so the
> > html
> > templates are hard to reuse. So I wonder, can we set the template as a
> > paramter to a component?
> >     Any suggestion will be appreciated.
> >
> > Alex
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

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


Re: How to set the template for a component or page dynamically?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I'm not quite sure of the specifics of your scenario, but a couple of 
brief thoughts:

  - you can override templates.  so if you have a library of components, 
you can override the HTML template by simply putting a the same HTML 
named file into the WEB-INF/classes directory in the right spot.

  - Use ITemplateSourceDelegate and do not include HTML templates into 
your application, and generate them dynamically however you like.

Erik

On Mar 17, 2004, at 9:07 PM, Alex Kwan wrote:

> Hi, All
>     The more work I have done with Tapestry, The more I found that the 
> real
> resuable part of the component are specification and classes of these
> components. Every web apps will has their own look and feel, so the 
> html
> templates are hard to reuse. So I wonder, can we set the template as a
> paramter to a component?
>     Any suggestion will be appreciated.
>
> Alex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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