how to : use googleMap plugin without enable it


I try to use googleMap plugin in a page without enable it in admin panel.

I have this code in a Codeblocks :

require_once (SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/GoogleMap/Map.php');
$album = newAlbum("images/images-gps.alb");
if (is_object($album)) {

<?php printGoogleMap(NULL, NULL, 'show', $album);?>

#map_canvas {
height: 550px;

this works but I have this error message displayed on top of the map:

Map display error

The GoogleMap plugin map display script has received a corrupt Map parameter. This is most likely caused by URL character limitations from your browser. For information on URL limits visit What is the maximum length of a URL.

You can try a different browser or contact the site manager for assistance.

If you are the manager of this site you can try the following:

Reduce the number of points being displayed
Reduce the text passed as the description of each point
Truncate the titles of the points

Despite this error, the map works fine (it seems I have all my geotaggued pictures in the map).

If I enable the plugin, I don't have the message.

Any idea to avoid this error ?

You can see the trouble here:


  • acrylian Administrator
    A plugin is naturally made and tested to be enabled. Why do you want to use it but not enable in the first place? This naturally can lead to issues as on some plugins respectively its plugin type it very well matters how they are loaded internally.

    Sorry I don't know about this issue and if it works enabled properly just do that.
  • The nature of how plugins work presumes that they are loaded from the outer block of code. Requiring one from a codeblock is actually invoking it from within a function. What this does in make variables that would have been global into ones local to the function. That is most likely the cause of the issue you see.

    It might be possible to find all the variables that are used globally and declare them global in you codeblock. But that seems overkill. Better would be to test if the plugin is enabled and only make the code call if it is.
  • in fact, my question is related to this old post:

    sometimes, loading of google script takes a lot of time, and I am thinking about solutions to use googlemap only on one page (called map page), to see all my geotaggued pictures on one place.

    to do that, I saw 2 solutions:
    - enable googlemap plugin and modify my code to not call googlemap (only in albums pages).
    but scripts are loaded everytime even if not required
    - disable googlemap plugin and invoke it in my map page. but it causes error message as described.

    and in fact, there is the way suggested by fretzl, that I have never tested :-(
  • acrylian Administrator
    I would assume that loading the actual map tiles is what takes most time on loading the map. But scripts are not loaded every time. The browser actually caches them so they are loaded only once (until the user clears its browser cache naturally).

    Have you tried the openstreetmap plugin instead? It offers the same functionality actually and loads far less scripts and nothing external besides the map tiles.
  • You can, if you wish, prevent the scripts from loading. It would require creating a "filter" for the theme_head that removed the undesired script loads when you are not on the "correct" page.

    There is an example plugin named `headConsolidator` that you could adapt for this.

    But is loading these scripts really the issue? As Acrylian has said, they do get cached by the browser (and maybe even the server.)
  • I have wrote this code in my inc_header.php file, called by all pages of my theme:

    if ( !( (($_zp_gallery_page == 'pages.php') && ((getPageTitleLink() == 'map')) ) || ($_zp_gallery_page == 'album.php')) ) {
    zp_remove_filter('theme_head', 'GoogleMap::js');
    with that, googlempa js are only allowed on albums pages (where google map plugin is used) and on my specific page where are displayed all my geotaggued pictures.

    it works fine for me.
  • error of mine
    I can't delete the post
Sign In or Register to comment.