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

    i use googlemapstv with a snippet :

    $tv = $modx->getObject('modTemplateVar',array('name'=>'google_maps'));
    $processedValue = $tv->renderOutput($docId);
    return $processedValue;
    


    when i call multi googlemaps with tab jquery, not working

    have change in googlemap.php for find the ID of page :

    $table = $modx->getFullTableName('site_tmplvar_contentvalues');
    $result=$modx->db->select('`contentid`',$table,'value="'.$value.'"');
    $row = $modx->db->getRow($result);
    $docId=$row[contentid];
    


    for change the id of

    <div class="'.$params['class'].'-map" id="tvgmap'.$docId.'"
    params['el'] ='tvmap'.$docId;
    



    but in the code of my page i have 2 tell of google script and window.onload

    how i do for work this code.

    Thanks a lot for your help.

    cordially

    laurent

      • 17422
      • 225 Posts
      i found how to do.


      i recover a javascript function :

      function addOnloadEvent(fnc){
        if ( typeof window.addEventListener != "undefined" )
          window.addEventListener( "load", fnc, false );
        else if ( typeof window.attachEvent != "undefined" ) {
          window.attachEvent( "onload", fnc );
        }
        else {
          if ( window.onload != null ) {
            var oldOnload = window.onload;
            window.onload = function ( e ) {
              oldOnload( e );
              window[fnc]();
            };
          }
          else
            window.onload = fnc;
        }
      }
      



      and in page core/model/modx/processsors/element/tv/renders/web/output/googlemap.php

      i change the code to :
      addOnloadEvent( function() {GTV.createMap('.$j.',"'.$TextDsFenetre.'");});
      


      $TextDsFenetre is the text for the popup in googlemap. because when a call this template variable in the chunk with getResources, it’s the text of the parent page. but i want it’s the text of children pages

      $table = $modx->getFullTableName('site_tmplvar_contentvalues');
      $result=$modx->db->select('`contentid`',$table,'value="'.$value.'"');
      $row = $modx->db->getRow($result);
      $docId=$row[contentid];
      $TextDsFenetreDE =$modx->getObject('modResource',$docId);
      $DESC = $TextDsFenetreDE->get('description');
      $pagetitle = $TextDsFenetreDE->get('pagetitle');
      $TextDsFenetre = "<strong>".$pagetitle."</strong><br />".$DESC;
      


      do not forget change throughout the code :

      this->get('id') 
      

      to
       
      $docId
      


      for the
      id="tvgmap'.$docId.'
      


      googlemap with fade jquery not work, use the position left in absolute. left:-9999 and left:0

      if it is not clear ask me smiley
        • 14951
        • 151 Posts
        IE 8 Seems to be throwing an "Object doesn’t support this property or method" error. It claims that the error resides in gtv.js on Line:122 / Char:13.

        This works amazing on all the other browsers I have tried. Anyone else experience this IE issue and/or have a potential resolution?

        Thanks!
        -Jared
          • 5552
          • 4 Posts
          I have seen this issue in IE6, (I only use for compatibility testing!) and the map does not show. Works fine in Firefox.
          I have started to debug and found the problem does appear to be on line 122.
                 ,isArray: function(v) {
                      return toString.apply(v) === '[object Array]';
                  }
          

          Insufficient time to root cause as yet but replacing code to always return false allows map to display.

          Chris
            • 14951
            • 151 Posts
            Hey cnother,

            Thanks for your reply. Do you have a copy of your hacked gtv.js? I don’t know my way around js at all. It will be interesting to see what the author of this tv has to say about this.

            Thanks!
            -Jared
              • 11782
              • 4 Posts
              HappyPelican Reply #6, 16 years ago
              I had the same problem. I just commented out line 122 and added "return false;"

                      ,isArray: function(v) {
                          //return toString.apply(v) === '[object Array]';
                          return false;
                      }


              That seemed to fix the IE issues for me, but it’s just a hack and may have broken something else - I wouldn’t know.
                - HappyPelican
                • 2607
                • 7 Posts
                Hi,

                I get strange display problems with googlemapstv rc3 (see attached image), this is across all tested browers (FF 4 b6, Opera 10.63, IE cool

                Looks like all overlays are missing transparency.

                Also the right click menus (Route to..) won’t show up. Console does not show any errors.

                If this helps: manager language is now set to en, was de when I first configured the tv (all settings changed now).
                  • 28881
                  • 18 Posts
                  I’m trying to call the GmapTV twice in the same template - (i.e two TV’s, called GMap1 and GMap2) but only the second one is rendering. Is it possible to do this, or should I try and get the variable output through a snippet?
                    • 17422
                    • 225 Posts
                    hi sunwukung,

                    i had the same problem;

                    see this :

                    http://modxcms.com/forums/index.php/topic,53798.msg311206.html#msg311206
                      • 24910
                      • 1 Posts
                      I had the same problem with the Map not rendering in IE and the error on line 122 of the gtv.js file so I replaced it with:
                      Old:
                              
                      ,isArray: function(v) {
                                  return toString.apply(v) === '[object Array]';
                              }


                      New:
                      ,isArray: function(v) {
                                  //check if v is an object as an array is an object
                                  if (typeof v == "object") 
                                  {
                                    //check the string value of the constructor for an array function
                                    var isArray = v.constructor.toString().match(/array/i);
                                    return ((isArray != null)?true:false);
                                  }
                                  //not an object so not an array
                                  return false;
                                  //toString.apply(v) === '[object Array]';
                              }
                      


                      I retested in IE, Chrome, FF and on my iPhone and the map is rendering.