You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Steve Ruby <st...@rubysolutions.com> on 2001/01/23 21:10:20 UTC

Variable concatenation


Is there anyway to perform something like the following?

#parse("/navigations/DefaultLeft_"$LangPref)

I have tried concatenating the two strings outside of the
parse() but it didn't work either.. like this

#set ( $LangPref = "en" )
#set ( $LangFile = "/navigations/DefaultLeft_"${LangPref} )
#parse($LangFile)

Re: Variable concatenation

Posted by Becky Grenier <be...@earthcars.com>.
Hi all,
I've never posted to this list, but I just happened to be working with this
same issue.
I believe the code you are looking for is:

#parse( "/navagations/DefaultLeft_${LangPref}" )

Using formal reference notation, a description of which can be found on
http://jakarta.apache.org/velocity/user-guide.html

--Becky

----- Original Message -----
From: "Steve Ruby" <st...@rubysolutions.com>
To: <ve...@jakarta.apache.org>
Sent: Tuesday, January 23, 2001 3:10 PM
Subject: Variable concatenation


>
>
> Is there anyway to perform something like the following?
>
> #parse("/navigations/DefaultLeft_"$LangPref)
>
> I have tried concatenating the two strings outside of the
> parse() but it didn't work either.. like this
>
> #set ( $LangPref = "en" )
> #set ( $LangFile = "/navigations/DefaultLeft_"${LangPref} )
> #parse($LangFile)


Re: Variable concatenation

Posted by Jon Stevens <jo...@latchkey.com>.
on 1/23/01 12:10 PM, "Steve Ruby" <st...@rubysolutions.com> wrote:

> Is there anyway to perform something like the following?
> 
> #parse("/navigations/DefaultLeft_"$LangPref)

#parse("/navigations/DefaultLeft_$LangPref")

-jon

-- 
Honk if you love peace and quiet.



Re: Variable concatenation

Posted by Jason van Zyl <jv...@periapt.com>.

On Tue, 23 Jan 2001, Steve Ruby wrote:

> 
> 
> Is there anyway to perform something like the following?
> 
> #parse("/navigations/DefaultLeft_"$LangPref)
> 
> I have tried concatenating the two strings outside of the
> parse() but it didn't work either.. like this
> 
> #set ( $LangPref = "en" )
> #set ( $LangFile = "/navigations/DefaultLeft_"${LangPref} )
> #parse($LangFile)

Everything has to be inside the double quotes:

#parse( "/navigations/DefaultLeft_$LangPref" )