none
multiple bing map inside foreach loop Ask RRS feed

  • Question

  •   <?php 
          foreach (list_visited_place() as $list_visited_place) { 
       ?>        
                    <div id="<?php echo $list_visited_place->id_visited_lived_place; ?>_visited_place_map" style='width: 400px; height: 400px; border: 3px solid black;'>
                    </div>
    
                    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?key=HEREMYKEY&callback=loadMapScenario' async defer></script>
                    <script type='text/javascript'>
                        function loadMapScenario() {
                          var  map = new Microsoft.Maps.Map(document.getElementById('<?php echo $list_visited_place->id_visited_lived_place; ?>_visited_place_map'), {});
                        }
                    </script>
         <?php
            }
         ?>

    That code only show map of the last element of the loop. Or i would like it to show maps of each elements of the loop.

    How could i do it please ?


    Thursday, February 28, 2019 8:17 PM

All replies