velocity - How to construct dynamic variable NAMES? -
i want loop on data, , create dynamic maps can later push more data into. example:
#foreach ($item in ["bob","john","andy"]) #set(${item}_map = {}) #end
so later can this:
$!bob_map.put("${foreach.count}", "${some_data}")
i do:
#foreach ($item in ["bob","john","andy"]) <div id="${item}_map" ></div> #end
so later can in js:
<script> var map; function initmap() { map = new google.maps.map(document.getelementbyid('bob_map'), { center: {lat: -34.397, lng: 150.644}, zoom: 8 }); } </script>
Comments
Post a Comment