We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8790
    • 526 Posts
    Hi Doze,


    The snippet is really cool everything is ok (well quit ok) but there’s something that remains confuse to me :

    the rendered code for the "Google marker’s bubble" is not stylized as It should be.

    I get the content of the marker’s document (ok) but is take a default document size (full width, so gets out of my page’s template)
    I guess the parent of the bubble is div#gmnoprint but is a bunch of div with style parameters inside html.

    Is there a way to get control on this bubble?? Do you have an example somewhere ?

    Thank you

      Schtroumpf Grognon - Grouchy Smurf
      ---------------------------------
      Faites pas attention.. - Don't pay attention
      http://www.dzi-neo.net
      • 7923
      • 4,213 Posts
      Visual bugs happen almost 100% because of css collisions with google maps css and your site template css. Try to cut down your site template css piece by piece and see what makes those bugs..


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 8790
        • 526 Posts
        hi,

        Thnak you, but I’m not sure about this collision.

        The fact is that the "bubble" is actually stylized within the html code, not with a css sheet and something actually gives a width: 690px; to this div wich is a very bad thing.
        here is the output:
        <div class="gmnoprint" style="position: absolute; left: -21px; top: -104px;">
        <div class="gmnoprint" style="position: relative; left: 0px; top: 0px; z-index: 10; width: 690px; height: 135px;">......


        class="gmnoprint" is not define anywhere (believing firebug) and adding a definiton in my css cant overide the element.style
        I suppose this is generated by some JS (wich one ?) ...probably hard coded ..isn’t it?

        I just need to define the width of the bubble.

        Thanks again
          Schtroumpf Grognon - Grouchy Smurf
          ---------------------------------
          Faites pas attention.. - Don&#39;t pay attention
          http://www.dzi-neo.net
          • 29525
          • 388 Posts
          elz64

          I had similar problems with this, a couple of weeks ago (see earlier post). For me, Doze was right. It was a CSS collision. I found the answer as he suggested by starting with a blank template, no CSS. The bubbles then formatted correctly. Next I systematically added back one style sheet at a time until I found which affected the bubble, then added in sections of that style sheet until I found the lines affecting it.

          Tedious, yes, but I found a non-obvious (and unexplained) solution.

          Here’s my map. http://www.terrybarthdesign.com/map-of-hotels.html

          Terry
            www.terrybarthdesign.com
            • 8790
            • 526 Posts
            Thanks Terry,


            it’s a long way to deal with this unclear issue.

            And, I have to admit, as, this is about my first serious MODx site, some stuff about the way I managed with css was not completely the way it should be today.

            I’m gonna test a popup window for the map, gonna be easier to unuse the main css this way..


            thanks again
            Eric
              Schtroumpf Grognon - Grouchy Smurf
              ---------------------------------
              Faites pas attention.. - Don&#39;t pay attention
              http://www.dzi-neo.net
              • 15819
              • 1 Posts
              Quote from: Delicious at Feb 03, 2007, 07:42 PM

              The snippet is great and working fine on my site now. But i want to make a long list of markers. Can anyone modify the snippet so a dropdownlist will appear (instead of a long list of markers)?
              Try this -

                       $script .= '
                              // arrays to hold copies of the markers and html used by the sidebar
                              // because the function closure trick doesnt work there
                              var sidebar_html = \'<select onchange="this.value != 0 ? eval(this.value) : null;"><option>Some Dummy Text(for zero option)</option>\';
                              var gmarkers = [];
                              var htmls = [];
                              var i = 0;
              
                              // a function to create the marker and set up the event window
                              function createMarker(point,name,html) {
                                  var marker = new GMarker(point);';
              
                  if($openMouseClickMarker) {
                      $script .= '
                                  // event listener to open info on click
                                  GEvent.addListener(marker, "click", function(){
                                      marker.openInfoWindowHtml(html);
                                  });';
                  }
              
                  if($openMouseOverMarker) {
                      $script .= '
                                  // The new marker "mouseover" listener
                                  GEvent.addListener(marker,"mouseover", function(){
                                      marker.openInfoWindowHtml(html);
                                  });';
                  }
              
                      $script .= '    
                                  // save the info we need to use later for the sidebar
                                  gmarkers[i] = marker;
                                  htmls[i] = html;
                                  // add a line to the sidebar html
                                  sidebar_html += \'<option ';
              
                      $script .= 'value="myclick(\' + i + \')"';
              
                      $script .= '>\' + name + \'</option>\';
                                  i++;
              
                                  return marker;
                              }
              
              				// This function picks up the click and opens the corresponding info window
              				function myclick(i) {
              					gmarkers[i].openInfoWindowHtml(htmls[i]);
              				}';
              	if($startID != "") {
              
              		$script .= $modx->runSnippet($dittoName,array('descendentDepth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => $dittoChunk, 'startID' => $startID, 'showPublishedOnly' => '0', 'trunc' => '0'));
              
                      $script .= '
                              // put the assembled sidebar_html contents into the sidebar div
              		  sidebar_html += "</select>";
                              document.getElementById("'.$linksDiv.'").innerHTML = sidebar_html;';
                  }
              




              instead of -

              		$script .= '
              				// arrays to hold copies of the markers and html used by the sidebar
              				// because the function closure trick doesnt work there
              				var sidebar_html = "";
              				var gmarkers = [];
              				var htmls = [];
              				var i = 0;
              
              				// a function to create the marker and set up the event window
              				function createMarker(point,name,html) {
              					var marker = new GMarker(point);';
              
              	if($openMouseClickMarker) {
              		$script .= '
              					// event listener to open info on click
              					GEvent.addListener(marker, "click",	function(){
              						marker.openInfoWindowHtml(html);
              					});';
              	}
              
              	if($openMouseOverMarker) {
              		$script .= '
              					// The new marker "mouseover" listener
              					GEvent.addListener(marker,"mouseover", function(){
              						marker.openInfoWindowHtml(html);
              					});';
              	}
              
              		$script .= '	
              					// save the info we need to use later for the sidebar
              					gmarkers[i] = marker;
              					htmls[i] = html;
              					// add a line to the sidebar html
              					sidebar_html += \'<div class="'.$linksClass.'"><a href="javascript:void(0)" ';
              
              	if($openMouseClickLink) {
              		$script .= 'onClick="myclick(\' + i + \')"';
              	}
              
              	if($openMouseOverLink) {
              		$script .= 'onMouseOver="myclick(\' + i + \')"';
              	}
              
              		$script .= '>\' + name + \'</a></div>\';
              					i++;
              
              					return marker;
              				}
              
              				// This function picks up the click and opens the corresponding info window
              				function myclick(i) {
              					gmarkers[i].openInfoWindowHtml(htmls[i]);
              				}';
              	if($startID != "") {
              
              		$script .= $modx->runSnippet($dittoName,array('descendentDepth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => $dittoChunk, 'startID' => $startID, 'showPublishedOnly' => '0', 'trunc' => '0'));
              
              		$script .= '
              				// put the assembled sidebar_html contents into the sidebar div
              				document.getElementById("'.$linksDiv.'").innerHTML = sidebar_html;';
              	}
                • 25551 ☆ A M B ☆
                • 1,231 Posts
                I can’t get this working at all...

                I’m using the simplest of templates to make sure there are no errors caused by conflicts.

                My call

                [!GoogleMapMarker? &startID=`321` &apiKey=`ABQIAAAAuhjlKhvjxltWAmGkoDCwZBSulM16ucgbSxbmWdix9hJWNNP_wxSDbijb4b27Is_9nwMgzdjR0Ry0bg`!]

                This is placed in the parent folder, in the child document I have a blank template, unpublished, title is home, description is 63.098332,23.056698 for example and nothing in the content.

                When I display the parent it says loading map... but there’s an error in the JS according to firebug.

                Error: GUnload is not defined
                Source File: http://www.xxx.com/index.php?id=321
                Line: 112

                I checked the source and here it is...
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                <head>
                <base href="http://www.xxx.com/"></base>
                <body>
                <div style="padding:20px">
                            <div id="map" style="float:left; width: 350px; height: 350px;">Loading map...</div>
                            <div id="maplinks" style="margin-left: 10px; padding-right: 10px; float: left; display: block; height: 350px; overflow: auto;"></div>
                            <noscript>
                                <b>JavaScript must be enabled in order for you to use Google Maps.</b> 
                                However, it seems JavaScript is either disabled or not supported by your browser.
                                To view Google Maps, enable JavaScript by changing your browser options, and then
                                try again.
                            </noscript>
                
                            
                </div>
                
                
                        <script type="text/javascript">
                        //<![CDATA[
                            
                            // addEvent scripts written by Dean Edwards, 2005
                            // with input from Tino Zijdel, Matthias Miller, Diego Perini
                            // http://dean.edwards.name/weblog/2005/10/add-event/
                
                            function addEvent(element, type, handler) {
                                if (element.addEventListener) {
                                    element.addEventListener(type, handler, false);
                                } else {
                                    // assign each event handler a unique ID
                                    if (!handler.$$guid) handler.$$guid = addEvent.guid++;
                                    // create a hash table of event types for the element
                                    if (!element.events) element.events = {};
                                    // create a hash table of event handlers for each element/event pair
                                    var handlers = element.events[type];
                                    if (!handlers) {
                                        handlers = element.events[type] = {};
                                        // store the existing event handler (if there is one)
                                        if (element["on" + type]) {
                                            handlers[0] = element["on" + type];
                                        }
                                    }
                                    // store the event handler in the hash table
                                    handlers[handler.$$guid] = handler;
                                    // assign a global event handler to do all the work
                                    element["on" + type] = handleEvent;
                                }
                            };
                            // a counter used to create unique IDs
                            addEvent.guid = 1;
                
                            function removeEvent(element, type, handler) {
                                if (element.removeEventListener) {
                                    element.removeEventListener(type, handler, false);
                                } else {
                                    // delete the event handler from the hash table
                                    if (element.events && element.events[type]) {
                                        delete element.events[type][handler.$$guid];
                                    }
                                }
                            };
                
                            function handleEvent(event) {
                                var returnValue = true;
                                // grab the event object (IE uses a global event object)
                                event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
                                // get a reference to the hash table of event handlers
                                var handlers = this.events[event.type];
                                // execute each event handler
                                for (var i in handlers) {
                                    this.$$handleEvent = handlers[i];
                                    if (this.$$handleEvent(event) === false) {
                                        returnValue = false;
                                    }
                                }
                                return returnValue;
                            };
                
                            function fixEvent(event) {
                                // add W3C standard event methods
                                event.preventDefault = fixEvent.preventDefault;
                                event.stopPropagation = fixEvent.stopPropagation;
                                return event;
                            };
                            fixEvent.preventDefault = function() {
                                this.returnValue = false;
                            };
                            fixEvent.stopPropagation = function() {
                                this.cancelBubble = true;
                            };
                                
                            addEvent(window, "unload", GUnload);
                
                            if (GBrowserIsCompatible()) {
                                // Display the map, with some controls
                                var map = new GMap2(document.getElementById("map"));
                                // set initial center position
                                map.setCenter(new GLatLng(63.098332,23.056698),8);
                    
                                //add controls to navigate / zoom
                                
                                map.addControl(new GLargeMapControl());
                                // add controls to change map type
                                map.addControl(new GMapTypeControl(0));
                                //set initial map type
                                
                                map.setMapType(G_NORMAL_MAP);
                                // arrays to hold copies of the markers and html used by the sidebar
                                // because the function closure trick doesnt work there
                                var sidebar_html = "";
                                var gmarkers = [];
                                var htmls = [];
                                var i = 0;
                
                                // a function to create the marker and set up the event window
                                function createMarker(point,name,html) {
                                    var marker = new GMarker(point);
                                    // event listener to open info on click
                                    GEvent.addListener(marker, "click", function(){
                                        marker.openInfoWindowHtml(html);
                                    });    
                                    // save the info we need to use later for the sidebar
                                    gmarkers[i] = marker;
                                    htmls[i] = html;
                                    // add a line to the sidebar html
                                    sidebar_html += '<div class="maplink"><a href="javascript:void(0)" onClick="myclick(' + i + ')">' + name + '</a></div>';
                                    i++;
                
                                    return marker;
                                }
                
                                // This function picks up the click and opens the corresponding info window
                                function myclick(i) {
                                    gmarkers[i].openInfoWindowHtml(htmls[i]);
                                }var point = new GLatLng(63.098332,23.056698); var marker = createMarker(point, '', ''); map.addOverlay(marker);
                                // put the assembled sidebar_html contents into the sidebar div
                                document.getElementById("maplinks").innerHTML = sidebar_html;
                                // ======== Add a map overview ==========
                                var ovcontrol = new GOverviewMapControl(new GSize(150,150)); 
                                map.addControl(ovcontrol,new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10)));
                                //set hidden by default (without animation)
                                ovcontrol.hide(1);
                            } else { // !GBrowserIsCompatible()
                                alert("Sorry, the Google Maps API is not compatible with this browser");
                            }
                    
                            // This Javascript is based on code provided by the
                            // Blackpool Community Church Javascript Team
                            // http://www.commchurch.freeserve.co.uk/ 
                            // http://www.econym.demon.co.uk/googlemaps/
                
                        //]]>
                        </script>
                        
                <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
                <script type="text/javascript">
                var pageTracker = _gat._getTracker("UA-xxx-6");
                pageTracker._initData();
                pageTracker._trackPageview();
                </script>
                </body>
                </html>



                Could someone help me a little with this as I just don’t seem to be able to get it sorted following the instructions. Thanks!
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart
                  • 29525
                  • 388 Posts
                  I have a situation that is preventing the map from loading. Loading Map. . .

                  I’ve determined it happens only when there is an apostrophe in the title of the document being mapped. I have have the phx:slashandstrip installed and is applied to the title field in the snippet.

                          $script .= $modx->runSnippet($dittoName,array('filter' => $filter, 'depth' => $descendentDepth, 'sortBy' => $sortBy, 'sortDir' => $sortDir, 'summarize' => 'all', 'displayArchive' => '0', 'tpl' => '@CODE:var point = new GLatLng([+sponsorlatitudelongitude+]); var marker = createMarker(point, \'[+title:slashandstrip+]\', \'<img src="[+sponsorlogo+]"/><h3>[+title+]</h3> [+sponsorstreetaddress+]<br />[+sponsorcitystatezip+]<br /> [+sponsortelephone+]\'); map.addOverlay(marker);', 'parents' => $startID, 'showPublishedOnly' => '0'));


                  Any suggestion’s?
                    www.terrybarthdesign.com
                    • 29525
                    • 388 Posts
                    Anyone?
                      www.terrybarthdesign.com
                      • 25551 ☆ A M B ☆
                      • 1,231 Posts
                      Terry perhaps you could check firebug and look at the error i have? Maybe it’s the same one?
                        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                        AugmentBLU - MODX Partner

                        BLUcart - MODX Revolution E-Commerce & Shopping Cart