• Hi there!

    IE doesn’t like commas after the last element in arrays (in JS). So I included a little helper variable (in php) which checks for each listing (marker types and markers) if it is the first element that it prints to the element. If so, just print the data and set the variable to false. If not, print the comma first and then the info.

    Here is the code:
    In file GoogleMapper/gmaps/single_map.php Replace the lines 57 to 97 with the following code:

    // icon definitions
          var icon_definitions = [
    <?php
    if ( is_array($icons) && count($icons) > 0 ) {
    $first = true;
      foreach( $icons as $icon ) {
        $anchor_points = explode(',', $icon->anchor_point);
        $iw_anchor_points  = explode(',', $icon->info_anchor_point);
      	if (!$first) {
      		echo "                                ,\n";
      	} else {
      		$first = false;
      	}
    ?>
                                    { icon_id:     '<?php echo $icon->id ?>',
                                      img_src:     '<?php echo $image_path.'/'.$icon->image_path ?>',
                                      img_size:    new GSize(<?php echo $icon->image_width ?>,<?php echo $icon->image_height ?>),
                                      shadow_src:  '<?php echo $image_path.'/'.$icon->shadow_path ?>',
                                      shadow_size: new GSize(<?php echo $icon->shadow_width ?>,<?php echo $icon->shadow_height ?>),
                                      anchor:      new GPoint(<?php echo $anchor_points[0].','.$anchor_points[1] ?>),
                                      iw_anchor:   new GPoint(<?php echo $iw_anchor_points[0].','.$iw_anchor_points[1] ?>)
                                    }
    <?php
      }
    }
    ?>
          ];
          var marker_definitions = [
    <?php
    if ( is_array($markers) && count($markers) > 0 ) {
    $first = true;
      foreach ($markers as $marker) {
      	if (!$first) {
      		echo "                                	,\n";
      	} else {
      		$first = false;
      	}
        ?>
                                          { marker_id: '<?php echo $marker->id ?>',
                                            title:     '<?php echo $marker->title ?>',
                                            lat:       <?php echo $marker->glat ?>,
                                            lng:       <?php echo $marker->glng ?>,
                                            sm_icon:   <?php echo $marker_types[$marker->marker_type_id]->sm_icon_id ?>,
                                            lg_icon:   <?php echo $marker_types[$marker->marker_type_id]->lg_icon_id ?>,
                                            info_window: '<?php echo str_replace(array("\r\n", "\r", "\n"), "", $marker->info_window) ?>'
                                          }
    <?php
      }
    }
    ?>
          ];

    That’s it.

    I really appreaciate the work you put into this plugin. It helps me a lot. But I also have a request/improvement. Can you add an option to disable the preview in admin panel. It gets quite annoying when you try to add many markers and always have to wait till the map is loaded because it blocks the browser (FireFox) for some seconds.

    Best wishes!
    Benjamin

Viewing 1 replies (of 1 total)
  • Hi Benjamin,

    Excellent Idea. I’ll add that to the list of Todo’s (shouldn’t be too difficult, which increases the chances I’ll be able to get to it fairly quickly 🙂 )

Viewing 1 replies (of 1 total)
  • The topic ‘Fix for IE [Googlemapper plugin]’ is closed to new replies.