We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24731 ☆ A M B ☆
    • 211 Posts
    Sure, here is my original snippet call:

    [[!Gmaps ? &language=`[[++cultureKey]]` &mapLatLng=`[[*mkrLatLng]]` &zoom=`17` &mkrClick=`info` &mkrOver=`info` &mkrIconTv=`mkrImg` &mkrTextTv=`mkrContent` &infoboxAjaxId=`50` &markers=`[[*id]]` &mkrLatLngTv=`mkrLatLng`]]


    This works correctly, the map is displayed at the right location and the infobox (when I click the marker) pops-up. However, the document it is requesting is index.php within the folder of the current document.

    So for example, if I am on

    /somefolder/contact.html

    It is trying to execute index.php within the /somefolder/ folder and thus throwing a 404.

    What's loaded into the infobox then is the "page not found" error page instead of the actual document I have set in &infoboxAjaxId=`50`.

    This is most likely due to me using Friendly URLs and using babel for multilingual setup which creates folders within this structure:

    /langcode/somefile.html
    /langcode2/somefile.html
    /langcode3/somefile.html

    and so on.

    An additional problem with the XMLHttpRequest() is that it involves the server into processing, which makes showing the infobox a lot slower than ideal (based on the document contents of course). I'm thinking in many cases the value can just be pulled from the TV without requiering additional server processing (at least in the case of 1 map and 1 marker on a single document).

    So to sum up, two problems:

    1) The ajax request on the infobox throws a 404.
    2) Would be a lot faster (in specific settings) to just pull the content from the mkrContent TV isntead of going through an additional page which then looks up the variable on the requested document.

    Jose R. Lopez
      • 5811
      • 1,717 Posts
      However, the document it is requesting is index.php within the folder of the current document.

      Yes the infoboxAjaxId page is loaded through a post request with &mkrid as parameter.
      Then the ajaxHandler return the mkrTextTv content of the marker. This works even with friendly urls.
      If you have a problem I think is rather due to babel than friendly urls.

      How is set your snippet call inside your document #50 ?
      Why do yo use &mkrTextTv=`mkrContent` inside the main snippet call ?

      As demonstration, I activate the friendly urls on my site and modify this demo to be similar to your snippet call. Look at http://www.revo.wangba.fr/one-marker-one-map.html

      Let me know when I could coming back to non-friendly url. It is better for the users interested by AdvSearch to follow the true page id.



      An additional problem with the XMLHttpRequest() is that it involves the server into processing, which makes showing the infobox a lot slower than ideal (based on the document contents of course). I'm thinking in many cases the value can just be pulled from the TV without requiering additional server processing (at least in the case of 1 map and 1 marker on a single document).

      I agree with you. But Gmaps should be used when you have several markers. Not only one.
      And with a lot of markers, it is not a good thing to preload all the infobox content.

      If you have only one marker, googleMapsTv is IMHO a better solution.
      [ed. note: coroico last edited this post 14 years, 10 months ago.]
        • 24731 ☆ A M B ☆
        • 211 Posts
        Thank you for your prompt reply.

        I can see your demostration with friendly urls working, but that wont make much difference because your document and index.php are within the same folder (root) in my case, the document is on a subfolder and as I said before, it is trying to access index.php within that folder, thus throwing a 404.

        If I request index.php from root by placing a slash (/index.php) then the infobox wont pop up.

        But you are right, using the TV would be much more efficient for my website.

        Thanks for pointing it out.

        Jose R Lopez
          • 36426
          • 197 Posts
          Oh no sorry I've really messed it up, now the page doesn't work at all. I replaced that line but it said there was an "unexpected / on line 359" so I downloaded Gmaps from the modx website and copied the contents of gmaps.class.inc.php to gmaps.class.php to see if that would get it back how it should be and now the page just gives the error:

          "Fatal error: Call to undefined method Gmaps::output() in /home/yorkcre1/public_html/inyorkholidays/core/cache/includes/elements/modsnippet/10.include.cache.php on line 33"

          So I deleted gmaps from package manager, reinstalled it and now the map is back but I've lost all my icons!!

          Thanks if you can please help.
            Yorkshire UK based hosting provider: https://www.simulant.uk
            • 24731 ☆ A M B ☆
            • 211 Posts
            coroico would you mind making a demo on your website that is within a subdirectory of root and not in root?

            I am trying to use your extra as it was intended, for multiple locations within a map. It works except for when I click on the infoboxes that popup. These are returning 404 page not found errors for me and all I can think of is due to my folder structure.

            Can you test placing the map on:

            /root/somesubfolder/somedocument.html

            and having your ajax document on root:

            /root/ajaxdocument.html

            then see if when you click on the infoboxes it properly loads the right document?

            Thanks.

            Jose R. Lopez
              • 36426
              • 197 Posts
              Hi, I've cleared the cache and used the new line of code but the info boxes still don't pop up when I hover over them with the mouse... Any suggestions. Thanks.
                Yorkshire UK based hosting provider: https://www.simulant.uk
                • 5811
                • 1,717 Posts
                @jonah

                I think you should check your .htaccess file.
                The mkrid parameter seems not received by the ajaxInfobox snippet. So an empty string is returned.


                @redstormj

                See http://www.revo.wangba.fr/revo-wangba-fr/gmaps/demos/gmaps-volcanoes.html
                The Friendly url and paths are activated.
                And the ajaxInfobox document handler is just under the #1 document (revo-wangba-fr) and the map two subfolders below (under gmaps/demos/)

                Are you sure of your htaccess (see my message to jonah) ?
                  • 24731 ☆ A M B ☆
                  • 211 Posts
                  Thanks Coroico, I see it working on your end, but on my end it keeps giving me a 404. It has to do something with my .htaccess (due to babel), I'm just not sure what else to try new. Here are the relevant portions in case you have any directions:

                  # detect language when requesting the root (/)
                  RewriteCond %{HTTP:Accept-Language} !^(en|es) [NC]
                  RewriteRule ^$ en/ [R=301,L]
                  RewriteRule ^$ es/ [R=301,L]
                  
                  # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
                  RewriteCond %{HTTP_HOST} .
                  RewriteCond %{HTTP_HOST} !^website\.com [NC]
                  RewriteRule (.*) http://website.com/$1 [R=301,L]
                  
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteRule ^(es|en)/favicon.ico$ favicon.ico [L,QSA]
                  
                  # redirect all requests to /de/assets* and /nl/assets* to /assets*
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteRule ^(es|en)/assets(.*)$ assets$2 [L,QSA]
                  
                  # redirect all other requests to /de/* and /nl/* to index.php and set the cultureKey parameter
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(es|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
                  
                  
                    • 5811
                    • 1,717 Posts
                    A new release (1.0.2) of Gmaps for Revo is available for downloading from the repository. See http://modx.com/extras/package/gmaps


                    New features:
                    - apiVersion parameter added
                    - method parameter (GET / POST) added
                    - mkrLatLngTv parameter improved. You could now use 2 Tvs for latitude & longitude
                    - mkrLinkTV parameter added. To specify a redirection page for the 'link' mode

                    Corrected issues;
                    - [#04] can't change the mapType parameter
                    - [#05] Wrong default iconDir directory.

                    WARNING: Now the default marker images directory is /assets/images/gmaps/
                    So, if you have some marker images inside assets/components/gmaps/images/ , move these marker images into this directory first. Or use the iconDir parameter to specify an another directory.

                    Look at http://www.revo.wangba.fr/index.php?id=132 for a demo of these new parameters.


                    Gmaps for Evo is now available from http://modx.com/extras/package/gmapsevo
                      • 35706
                      • 4 Posts
                      I'm loving this plug-in! Really usefull addition to my site.
                      One issue though, I'd like al my resources to show up on the map, but I want the map to center around one specific marker. This only works when there just one marker. Is there a way to set the center of the map (&mapLatLng) and have this overrule the automatic centering on the barycenter of the markers?

                      Cheers, Peter