2

I am using dotCMS server to generate templates based on specified URL using velocity as shown in below.

#foreach($Innowid in $dotcontent.pull("+structureName:Innowid +(conhost:a2f01224-2885-40fd-bde4-a60ae02e3a12 conhost:SYSTEM_HOST)",10,"Innowid.vizlink"))
#editContentlet($Innowid.inode)
<div id="viz" class="visuals"></div>
<script type="text/javascript">
    var url=$!{Innowid.vizlink};
</script>
#end

While iterating "url" value is changing.But it is assigning like var url=https://www.google.co.in/?gfe_rd=cr&ei=fVNMVdahH8GS8QfyqoGQDw&gws_rd=ssl

Now I want to convert the url into a string.

Jud
  • 1,324
  • 3
  • 24
  • 47
Nikhitha Reddy
  • 285
  • 7
  • 19

2 Answers2

6

Wrap the variable in quotes or apostrophes.

var url="$!{Innowid.vizlink}";

You are generating plain Javascript code after all.

vzsg
  • 2,831
  • 17
  • 20
0

Put all your variables into string literal. Autoboxing casts even numbers:

#set($newUrl = "$someObj.someProp/someTail/somePage?routeId=$routeId")
Sergio Kosik
  • 192
  • 2
  • 6