You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hilco Wijbenga <hi...@gmail.com> on 2010/03/04 02:17:02 UTC

How to dynamically detemine the asset path?

Hi all,

I used to have (in my .tml):

<img src="${asset:image.png}" ... />

which of course worked fine.

To support multiple colours I need a little bit more flexibility so I
tried to do

<img src="${asset:image_${variable}.png}" ... />

which failed miserably because T5 doesn't do variable expansion inside
variable expansions. Not entirely unreasonable, I suppose. :-)

I had a look at T5's Request object but it doesn't tell me the asset
path (AFAICT). How do I do this without completely hard coding the
asset path?

Cheers,
Hilco

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


Re: How to dynamically detemine the asset path?

Posted by Howard Lewis Ship <hl...@gmail.com>.
That's what Java code is for ... you can inject the AssetSource
service to obtain assets from dynamically-assembled strings.

On Wed, Mar 3, 2010 at 5:17 PM, Hilco Wijbenga <hi...@gmail.com> wrote:
> Hi all,
>
> I used to have (in my .tml):
>
> <img src="${asset:image.png}" ... />
>
> which of course worked fine.
>
> To support multiple colours I need a little bit more flexibility so I
> tried to do
>
> <img src="${asset:image_${variable}.png}" ... />
>
> which failed miserably because T5 doesn't do variable expansion inside
> variable expansions. Not entirely unreasonable, I suppose. :-)
>
> I had a look at T5's Request object but it doesn't tell me the asset
> path (AFAICT). How do I do this without completely hard coding the
> asset path?
>
> Cheers,
> Hilco
>
> ---------------------------------------------------------------------
> 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