If "skin" is a component property that's properly evaluated for you,
you can return the evaluated path as a page property to an Any
component in the template for the <link>:

In TheComponent.java

private String _skin // perhaps a parameter or resolved in onActivate?

public String getStylesheetPath ()
{
    return "/static/css/" + _skin + "/color-scheme.css";
}

In TheComponent.html:

...
<link t:type="any" element="link" rel="stylesheet" type="text/css"
href="prop:stylesheetPath" />
...

Bill

On 5/17/07, Martin Reurings <[EMAIL PROTECTED]> wrote:
We've created a simple template component to render the generic html layout
of the page and handle things like the navigation in the near future. Since
we've just started to use tapestry I am still trying to get my head around
some of the things that would probably seem obvious to anybody else.

I will have several CSS files linked in the head of my html file, since the
url to a specific page is unknown and may be nested in a directory structure
these files need to be absolute and should have the context root included.

Now I've figured out how to do that using this:
    @Inject
    @Path("context:static/css/layout.css")
    private Asset layoutCSS;

The layout doesn't change, this is fine with me, but the color-scheme will
change depending on which section of the site a user is browsing in and this
introduces a variable in the directory structure. Now I've figured out how
to use a property to pass that value on to my template component:
<t:SiteDesign title="literal:xyz" skin="literal:advertiser" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>

However, I have spent some time trying to figure out how to get this value
injected into my accual url, as this doesn't work:
    @Inject
    @Path("context:static/css/${skin}/color-scheme.css")
    private Asset skinCSS;

Can anybody tell me what the preferred way of solving this issue would be?

Thanx,

 Martin

--
(   /'  _/_ __  _ _
|/|///)(/(/(//_(-/
        _/
Website: http://www.windgazer.nl



--
"The future is here.  It's just not evenly distributed yet."

    -- Traditional

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to