context variables in slots

I’m trying to use a context variable in a slot but its not rendering. So I’ve set a header and footer and in the header I’m trying to insert an image and I’m using the $rxs_navbase to point to the images folder.

Here’s the code

#set($NewsUpdatesHeader = ‘<img src="${rxs_navbase}/images/homepage/title-newsFeatures.gif" width=“350” height=“42”>’)

#set($NewsUpdatesFooter = ‘’)

#slot(“cicaNewsUpdatesAuto” “$NewsUpdatesHeader” “” “” “$NewsUpdatesFooter” $newsParams)

But it doesn’t render the $rxs_navbase. It renders outside the slot, just not in the slot. Anyone have any ideas?


Have you defined $rxs_navbase as $sys.variables.rxs_navbase in the bindings of the snippet template?

Yes I’ve defined the variable. It works everywhere on the page I’ve placed it except in the slot.

Try to change your code so that the set is using double quotes instead of single in the overall assignment. Inside that, you also have to replace the double quotes with single quotes.

#set($NewsUpdatesHeader = “<img src=’${rxs_navbase}/images/homepage/title-newsFeatures.gif’ width=‘350’ height=‘42’>”)

fernando is correct, i believe the variables will only be substituted/rendered/calculated inside of double quotes.

as you do want the html tags to render with double quotes, i would recommend a string concat…

Awsome thanks guys, the double quotes worked.

If anyone else is looking for this, here’s the total solution working with double quotes in the html. I simply set another variable for the quote and called that throughout the rest of the sets. Seems to be working, if there’s an easier solution, i’m totally open to that.

#set ($dq = ’ " ')
#set($NewsUpdatesHeader = “<img src=${dq}${rxs_navbase}/images/homepage/title-newsFeatures.gif${dq} width=${dq}350${dq} height=${dq}42${dq}>”)