PHP file with html and javascript inside of Joomla with JUMI doesnt show anything - duplicate header and body? -
the google maps javascript api contains simple example if put copy/paste html file , place on server works nicely.
however want 'copy/paste' code php file , able call javascript functions 'add markers' map (eventually) - in order need understanding how html code works - because not understand how displaying page.
https://developers.google.com/maps/documentation/javascript/examples/map-simple
below current php file see no php code other opening , closing php @ time , copy paste of google maps example - yet divs, , believe meta doesn't 'work' because can't have head? or body? in joomla article?
what expect see when run file in joomla same thing see if open php file - yet nothing shows (other hello world text)...
<?php ?> <head> <title>simple map</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { margin: 0; padding: 0; height: 100%; } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> var map; function initialize() { var mapoptions = { zoom: 8, center: new google.maps.latlng(44.981314, -93.25633), maptypeid: google.maps.maptypeid.hybrid }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var mylatlng = new google.maps.latlng(44.964251, -93.266459); var marker = new google.maps.marker({ position: mylatlng, title: "hello world!" }); marker.setmap(map); } google.maps.event.adddomlistener(window, 'load', initialize); </script> </head> <body> hello world <div id="map-canvas"></div> </body>
i tried out , reproduced issue. if @ firebug can see map retrieved joomla not displaying whatever reason.
duplicate header/body not issue (you can load sites no problem, although not idea not w3c compatible). proof of concept fine.
i don't have solution thought worth mentioning 2 options here:
build own module. easy. may seem daunting @ first tutorial great. way build clean no duplicate content :)
why reinvent wheel? use extension. can need , more. example: http://extensions.joomla.org/extensions/maps-a-weather/maps-a-locations/maps/1147
Comments
Post a Comment