Posted By

cyberhobo on 04/03/12


Tagged

wordpress-geo-mashup custom-js map-frame


Versions (?)

Load a javascript library (MarkerWithLabel) in a Geo Mashup map frame template


 / Published in: PHP
 

URL: https://code.google.com/p/wordpress-geo-mashup/wiki/JavaScriptApi

This is very close to the default map frame template that comes with Geo Mashup, but it registers and queues the external library.

  1. <?php
  2. /**
  3.  * Load the MarkerWithLabel library in the Geo Mashup map frame.
  4.  */
  5. global $geo_mashup_custom;
  6. wp_register_script( 'googlev3-marker-with-label', path_join( $geo_mashup_custom->url_path, 'markerwithlabel.js' ), array( 'google-maps-3' ), false, true );
  7. GeoMashupRenderMap::enqueue_script( 'googlev3-marker-with-label' );
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  10. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <!--[if lte IE 6]>
  13. <html xmlns:v="urn:schemas-microsoft-com:vml">
  14. <![endif]-->
  15.  
  16. <head>
  17. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  18. <title>Geo Mashup Map</title>
  19. <?php GeoMashupRenderMap::head(); ?>
  20.  
  21. <style type="text/css">
  22. v\:* { behavior:url(#default#VML); }
  23. #geo-mashup {
  24. width:<?php echo GeoMashupRenderMap::map_property( 'width' ); ?>;
  25. height:<?php echo GeoMashupRenderMap::map_property( 'height' ); ?>;
  26. <?php if ( GeoMashupRenderMap::map_property( 'background_color' ) ) : ?>
  27. background-color: <?php echo GeoMashupRenderMap::map_property( 'background_color' ); ?>;
  28. <?php endif; ?>
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div id="geo-mashup">
  34. <noscript>
  35. <p><?php _e( 'This map requires JavaScript. You may have to enable it in your settings.', 'GeoMashup' ); ?></p>
  36. </noscript>
  37. </div>
  38. <?php echo GeoMashupRenderMap::map_script( 'geo-mashup' ); ?>
  39. </body>
  40. </html>

Report this snippet  

You need to login to post a comment.