On Jul 1, 2011, at 12:32 PM, Howard Lewis Ship wrote:

> On Fri, Jul 1, 2011 at 4:37 AM, Thiago H. de Paula Figueiredo
> <thiag...@gmail.com> wrote:
>> On Fri, 01 Jul 2011 07:31:18 -0300, <p.stavrini...@albourne.com> wrote:
>> 
>>> Hello everyone!
>> 
>> Hi!
>> 
>>> Is it possible to nest the output of variables, i.e.: something like:
>>> <img src="${asset:context:images/${variable}/logo.gif}" />
> 
> No this is not supported, but you could inject the AssetSource service
> into your component class and construct the "context:images/..."
> string there instead.


I did it like this.. 

[snip]

    @Property
    private LETTER selectedLetter;

    public LETTER[] getLetters() {
        return LETTER.values();
    }

    @Inject
    @Path("context:images/letters/")
    private Asset pathPrefix;

    public String getImagePath() {
        return pathPrefix.toClientURL() + "/" + 
selectedLetter.name().toLowerCase() + ".gif";
    }

[/snip]

and in my tml

                <t:loop source="letters" value="selectedLetter">
                    <t:linksubmit t:id="letterSubmit" context="selectedLetter" 
border="0" defer="false">
                        <img src="${imagePath}" alt="${selectedLetter}"/>
                    </t:linksubmit>
                </t:loop>


Hope that helps.

-Tony


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

Reply via email to