You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by P....@albourne.com on 2011/07/01 12:31:18 UTC

Simple question

Hello everyone!

Is it possible to nest the output of variables, i.e.: something like:
<img src="${asset:context:images/${variable}/logo.gif}" /> 

I know there are other solutions, but just asking if there is some syntax to do this type of thing?

Thanks!
Peter


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


Re: Simple question

Posted by Tony Nelson <tn...@starpoint.com>.
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
> <th...@gmail.com> wrote:
>> On Fri, 01 Jul 2011 07:31:18 -0300, <P....@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Simple question

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Fri, Jul 1, 2011 at 4:37 AM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Fri, 01 Jul 2011 07:31:18 -0300, <P....@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.

Also, FYI, there's a binding prefix, "context:" that is simply the
same as "asset:context:".

>
> I don't think so. As far as I can remember, you can use symbol expansions,
> but not property ones in asset bindings.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: Simple question

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 01 Jul 2011 07:31:18 -0300, <P....@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}" />

I don't think so. As far as I can remember, you can use symbol expansions,  
but not property ones in asset bindings.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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