Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8457979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:57:15+00:00 2026-06-10T12:57:15+00:00

I am working in joomla 2.5 and I have to create a module for

  • 0

I am working in joomla 2.5 and I have to create a module for Google map and using Google map api v2.

and I am using geocoder = new GClientGeocoder(); but it is now working

output image:- enter image description here

My html <div> tag

<div id="map_canvas" style="width: 800px; height:800px;"></div>

My script

<script>

    //<![CDATA[
    var map = null;
    var geocoder = null;

    function initialize() {

        if (GBrowserIsCompatible()) {

        //calls map to appear inside <div> with id, "map_canvas"
        map = new GMap2(document.getElementById("map_canvas"));

        //adds zoom and arrow controls to map


        geocoder = new GClientGeocoder();

        map.setMapType(G_SATELLITE_MAP);

        var allAddress = "Dubai~Abu Dhabi";
        var addresses = new Array();
        addresses = allAddress.split("~");  



        var curIndex = 0;

        function showAddress() {

          var _cur = addresses[curIndex];


          geocoder.getLatLng(
            _cur,
            function(point) {
            alert(_cur);
              if (!point) {
            alert(_cur + " not found");
              } else {
            alert(_cur+":"+point);


              }
              //do next after done
              curIndex++;
              if(curIndex<addresses.length)
            showAddress();
            }
          );
        }

        showAddress();
         }  
}
//]]>
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:57:16+00:00Added an answer on June 10, 2026 at 12:57 pm

    See below code and try it.

    I am using php static array you can connect your database and create array according your requirement. see the array below.

    <?php  $item = array('jaipur, rajasthan,india', 'udaipur, rajasthan,india'); ?>
    

    Below My Code Take a look.

    <html>
        <head>
            <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyDwFjOazEAe1MI7nHV6vUwkWytOp8LH2Zk" type="text/javascript"></script>
        </head>
        <body onload="initialize();">
        <?php  $item = array('jaipur, rajasthan,india', 'udaipur, rajasthan,india'); ?>
        <script>
        var map = null;
        var geocoder = null;
    
        function initialize() {
                if (GBrowserIsCompatible()) {
    
    
                        map = new GMap2(document.getElementById("map_canvas"));
                        var addresses = ["<?php echo implode ('","', $item); ?>"]
    
    
                        var geocoder = new GClientGeocoder();
                        //var addresses = ["A II Z, Ibn Battuta Mall, Sheikh Zayed Road, 5th Interchange, Jebel Ali Village, Dubai","A. Testoni,Dubai Festival City Mall, Ground Floor, Dubai", "Abdulla Hussain Khunji, The Dubai Mall,Downtown, Abu Dhabi"];
                        var curIndex = 0;
    
                        function showAddress() {
                          var _cur = addresses[curIndex];
                          geocoder.getLatLng(
                            _cur,
                            function(point) {
                              if (!point) {
                                //alert(_cur + " not found");
                                //map.setCenter(new GLatLng(0, 0), 6);
                                //map.setUIToDefault();
                              } else {
                                //console.log(_cur+":"+point);
                                //alert(_cur);
                                        var cafeIcon = new GIcon(G_DEFAULT_ICON);
    
                                        // Set up our GMarkerOptions object
                                        markerOptions = { icon:cafeIcon };
    
                                        map.setCenter(point, 6);
                                        var marker = new GMarker(point, markerOptions);
                                        map.addOverlay(marker);
    
                                        var sales = new Array();
                                        sales = _cur.split("|");
    
    
                                        //Add click event on push pin to open info window on click of the icon
                                        GEvent.addListener(marker, "click", function() {
                                                marker.openInfoWindowHtml("<p class='para1bold' style=\"font-weight: bold;\">Address <br /><span class='para1' style='font-weight:normal;'>" + sales[1] + "</span></p>");
                                        });
                                        //Provides map,satellite,hybrid and terrain views in the map along with zoom control
    
    
                                        map.setUIToDefault();
                              }
                              //do next after done
    
                              curIndex++;
    
                              if(curIndex<addresses.length)
                                showAddress();
                            }
                          );
                        }
                        showAddress();
           }  
        }
        </script>
        <div id="map_canvas" style="width:100%; height:750px;"></div>
      </body> 
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed new site in Joomla 1.7 and its working fine, but when
We have already created custom module for searching but pagination not working. we have
I am really new to Joomla and Virtue Mart and have inherited a working
I have used mysql mysql_real_escape_string($somevariable) in my code developed using Joomla! api. Everything is
I have a custom component built for a Joomla 2.5 website. It is working
I am working on one joomla(2.5.1) site and i need one module for one
I'm working on a php project based on Joomla! and i'm using Aptana. I'm
I have a joomla application working on Apache.To improve site performace we have written
I am working on Joomla 1.5 . i have a link to an article
I have a working contact form in Joomla however when the user submits the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.