Friday, November 22, 2013

EC2 Ubuntu Apache PHP MySQL Setup


  1. In order to connect to the instance we need to assign an IP address. In the left menu in the EC2 Management Console select Elastic IPs under Network & Security. Allocate a new address and assign it to your instance. Elastic IPs are free as long as they are assigned to an instance, so remeber not to leave any unallocated IP addresses as you will get charged by the hour. Remember the assigned IP.
  2. On your local machine use the pem key to SSH into your instance. On OS X change the permission of the key to 600 and use following command in terminal:
    ssh -i yourkeyname.pem ubuntu@yourelasticip
    and boom you are in.
  3. Update the Ubuntu package manager and the installed packages:
    sudo apt-get update
    sudo apt-get dist-upgrade
  4. Install Apache:
    sudo apt-get install apache2
  5. Enable .htaccess files by editing the /etc/apache2/sites-available/default file, fx with vi or nano. Look for the /var/www directory and make sure it contains AllowOverride All.     <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
    </Directory>
  6. Enable the rewrite module in Apache:
    sudo a2enmod rewrite
  7. Install PHP5:
    sudo apt-get install libapache2-mod-php5
  8. Restart Apache:
    sudo /etc/init.d/apache2 restart
  9. Ensure that Apache is running by typing the instance IP in your browser.
  10. Allow the Ubuntu user to work with the /var/www folder:
    sudo adduser ubuntu www-data
    sudo chown -R www-data:www-data /var/www
    sudo chmod -R g+rw /var/www
    Logout and login again to pick up the new user group. Test by creating a directory and deleting it again in www without having to sudo. This will make your life easier since permissions will get messed up less once you start adding frameworks and tools to your web service.
  11. Test PHP by cd into /var/www folder and typing sudo vi phptest.php. Hit i key to enter insert mode and just write a simple php script with a phpinfo() call.
    Hit ESC to exit insert mode and type :wq to save and quit the vi editor. Go to instanceIP/phptest.php in your browser and you should see the phpinfo displayed.
  12. Install MySQL:
    sudo apt-get install mysql-server
    sudo apt-get install php5-mysql
    Insert root password for the database and remember it.
  13. To test MySQL let’s install PHPMyAdmin:
    sudo apt-get install phpmyadmin
Next I think you need to install git.I don't prefer to use FTP client.
  1. sudo apt-get install git

Wednesday, August 28, 2013

How to run Composer autoload and CodeIgniter autoload simultaneously

Did you tried to install composer and then you existing CodeIgniter Autoload stop working!!! It happened because __autoload is the old, deprecated way of doing autoloading and you can have only one.

How to run it?
You should register your autoloader using spl_autoload_register.
How you will do it in your code..Here is an example below...

function MY_CI_Autoload($class)
{
 if(strpos($class, 'CI_') !== 0)
 {
  @include_once( APPPATH . 'core/'. $class . EXT );
 }
}

spl_autoload_register('MY_CI_Autoload');

This way your autoloader and composer's will coexist happily.

Saturday, August 17, 2013

My MAMP MySql is not turning on!!!!!!!

I have updated my MAMP version to 2.0 and after that my mysql stop working.
This command worked for me and after running the following in my command line it start working again.. :)
     ps aux | grep mysql 
     lsof -i 
     killall -9 mysqld
if needed
    sudo killall -9 mysqld

Using composer with MAMP’s version of PHP

One tool I have been playing with recently is Composer which is a dependency manager, think Ruby Gems but for PHP. Which is a great little tool and I’m really happy to see the community getting behind it and moving forward. After just trying to install composer I ran into a little problem which I thought was worth sharing.
After running curl -s https://getcomposer.org/installer | php, I get the following error:

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
    detect_unicode = Off


Which looks pretty simple to fix but MAMP should have this setting disabled. So I ranwhich php and I’m told I’m running /usr/bin/php which is the version of PHP that comes preinstalled with OS X. So we just need to swap this over to the PHP that is installed with MAMP, which is located at

 /Applications/MAMP/bin/php/php5.3.6/bin 

To do this I edit my .bash_profile or .profile if you are using a different shell and add the MAMP version of PHP to the PATH variable.

export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:$PATH

It’s important to append the existing $PATH at the end otherwise the version of PHP in /usr/bin/php will be found and loaded first instead. Save the .bash_profile and reload your profile by typing

 source ~/.bash_profile

and run which php, and if you’ve done everything right should say /Applications/MAMP/bin/php/php5.3.6/bin/php.

Saturday, June 8, 2013

How to list all CRON Jobs for all user

To have a improved output formatting you can run the following command in you terminal.

for user in $(cut -f1 -d: /etc/passwd)
do echo $user && crontab -u $user -l
echo " "
done

Wednesday, May 22, 2013

Easy way to delete all objects from S3 bucket

I had to delete a bucket from S3 server But the problem is, a bucket can only be deleted if it is empty. Delete objects using User Interface on Amazon S3 management console is a tough job and very time consuming. Take a look at the following screenshot.


If a bucket hold more then 10000 objects then how you will do it?

If you are familier with Amazon SDK PHP2 go with the following code to accomplish this task easily..
require 'vendor/autoload.php';

use Aws\S3\S3Client;
use Aws\S3\Model\ClearBucket;

$s3 = S3Client::factory(array(
    'key' => 'write_your_key_here',
    'secret' => 'write_your_secret_key_here'
));

$bucket = 'your_bucket_name';

$clear = new ClearBucket($s3, $bucket);
$clear->clear();

// Delete the bucket
$result = $s3->deleteBucket(array('Bucket' => $bucket));

// Wait until the bucket is not accessible
$result1 = $s3->waitUntilBucketNotExists(array('Bucket' => $bucket));

Another way to do this..
$bucket = 'your_bucket_name';

$iterator = $s3->getIterator('ListObjects', array(
    'Bucket' => $bucket
));

$s3->registerStreamWrapper();

foreach ($iterator as $object) {
    unlink('s3://'.$bucket.'/'.$object['Key']);
}

Monday, May 13, 2013

How to use JW Player on FancyBox

How I got JW Player working inside FancyBox


    jQuery(".position1").fancybox({
        'content':'
Big Opportunity, Health, Convenience , Trading up – Leah Weckert
', maxWidth:800, maxHeight:600, fitToView:false, width:'70%', height:'70%', autoSize:true, closeClick:false, openEffect:'none', closeEffect:'none', afterShow:function () { jwplayer('mediaspace').setup({ 'flashplayer':'/coles-brand/js/jwplayer/jwplayer.flash.swf', 'file':"http://www.blipunited.com/lb/video.mp4", 'image':'http://img.youtube.com/vi/LtGoBZ4D4_E/0.jpg', 'provider':'youtube', 'height':400, 'width':700, 'controlbar.position':'bottom' }); } });

Monday, May 6, 2013

Install Solr in 10 munite

I am working on a Property Listing web site for long which is based on RETS(Real Estate Transaction Standard). It has more then 300000 listing in total  for single RETS server and planing to added more RETS server in the system. Day by day data(listing) are increasing and the question scalability become more visible.
Solr makes it easy to run a full-featured search server. In fact, its so easy, It can be setup spending 10-15 min..
  • Installing Solr
  • Starting Solr
  • Indexing Data
  • Searching
  • Shutdown

Installing Solr

For the purposes of this tutorial, I'll assume you're on a Linux or Mac environment.
You should also have JDK 5 or above installed.
wget http://archive.apache.org/dist/lucene/solr/3.4.0/apache-solr-3.4.0.zip
tar -zxvf apache-solr-3.4.0.tgz
cd apache-solr-3.4.0

Starting Solr

Solr comes with an example directory which contains some sample files we can use.
We start this example server with java -jar start.jar.
cd example
java -jar start.jar
You should see something like this in the terminal.
2011-10-02 05:20:27.120:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2011-10-02 05:20:27.212:INFO::jetty-6.1-SNAPSHOT
....
2011-10-02 05:18:27.645:INFO::Started SocketConnector@0.0.0.0:8983
Solr is now running! You can now access the Solr Admin webapp by loadinghttp://localhost:8983/solr/admin/ in your web browser.

Indexing Data

We're now going to add some sample data to our Solr instance.
The exampledocs folder contains some XML files we can use.
A quick glance at one of the XML files reveals that each Solr document consists of multiple fields. Each field has a name and a value. For example:
<doc>
  <field name="id">9885A004</field>
  <field name="name">Canon PowerShot SD500</field>
  <field name="manu">Canon Inc.</field>
...
  <field name="inStock">true</field>
</doc>
The post.sh shell script in the same folder provides a convenient way to add files to Solr via HTTP POST.
cd exampledocs
./post.sh monitor.xml
That produces:
Posting file monitor.xml to http://localhost:8983/solr/update
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><intname="QTime">89</int></lst>
</response>
This response tells us that the POST operation was successful.
Note that there are 2 main ways of adding data to Solr:
  1. HTTP
  2. Native client
We'll explore these in greater detail in a subsequent tutorial.

Searching

Let's see if we can retrieve the document we just added.
Since Solr accepts HTTP requests, you can use your web browser to communicate with Solr: http://localhost:8983/solr/select?q=*:*&wt=json
This returns the following JSON result:
{
    "responseHeader": {
        "status": 0,
        "QTime": 0,
        "params": {
            "wt": "json",
            "q": "*:*"
        }
    },
    "response": {
        "numFound": 1,
        "start": 0,
        "docs": [
            {
                "id": "3007WFP",
                "name": "Dell Widescreen UltraSharp 3007WFP",
                "manu": "Dell, Inc.",
                "includes": "USB cable",
                "weight": 401.6,
                "price": 2199,
                "popularity": 6,
                "inStock": true,
                "store": "43.17614,-90.57341",
                "cat": [
                    "electronics",
                    "monitor"
                ],
                "features": [
                    "30\" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast"
                ]
            }
        ]
    }
}
Nice! A quick verification with monitor.xml should confirm that all is in order.
Note that the previous search query used the special *:* syntax to retrieve all documents.
Let's now add all the XML documents, and do some real searching.
./post.sh *.xml
Here's a demonstration of retrieving the name and id of all documents with inStock = falsehttp://localhost:8983/solr/select?q=inStock:false&wt=json&fl=id,name
{
    "responseHeader": {
        "status": 0,
        "QTime": 2,
        "params": {
            "wt": "json",
            "q": "inStock:false",
            "fl": "id,name"
        }
    },
    "response": {
        "numFound": 4,
        "start": 0,
        "docs": [
            {
                "id": "F8V7067-APL-KIT",
                "name": "Belkin Mobile Power Cord for iPod w/ Dock"
            },
            {
                "id": "IW-02",
                "name": "iPod & iPod Mini USB 2.0 Cable"
            },
            {
                "id": "EN7800GTX/2DHTV/256M",
                "name": "ASUS Extreme N7800GTX/2DHTV (256 MB)"
            },
            {
                "id": "100-435805",
                "name": "ATI Radeon X1900 XTX 512 MB PCIE Video Card"
            }
        ]
    }
}
You'll learn more about the various URL query parameters in a separate tutorial.

Shutdown

To shutdown Solr, from the terminal where you launched Solr, hit Ctrl+C. This will shutdown Solr cleanly.
Solr is fairly robust, so even in situations of OS or disk crashes, it is unlikely that Solr's index will become corrupted.

Using CURL as WGET Replacement in MAC

I was trying to download file in my MAC using "wget" but I found that "wget" is not available in MAC by default. After searching for few min I found a easy solution. CURL can be used to accomplish the same task. 

CURL Command is 
"curl -O http://apache.spinellicreations.com/lucene/solr/3.6.2/apache-solr-3.6.2.tgz"

To create an alias called `wget` that will simply run the command curl -O I ran the following command in my MAC terminal.


echo 'alias wget="curl -O"' >> ~/.bash_profile

Now when I run "wget",  it is actually executing curl -O to download the file.

"wget http://apache.spinellicreations.com/lucene/solr/3.6.2/apache-solr-3.6.2.tgz"

Hope this article is helpful for you...

Saturday, May 4, 2013

RETS Search Transaction Reply Codes


During working on RETS Server lots of time I got some error code and I thought to have the meaning of those code. At last I found those code and their meaning in the following location..
https://retsdoc.atlassian.net/wiki/display/rets172/7.8+Reply+Codes

I am also adding those code and their meaning right here

Reply Code
Meaning
0
Operation successful.
20200
Unknown Query Field 
The query could not be understood due to an unknown field name.
20201
No Records Found 
No matching records were found.
20202
Invalid Select 
The Select statement contains field names that are not recognized by the server.
20203
Miscellaneous Search Error 
The quoted-string of the body-start-line contains text that MAY be displayed to the user.
20206
Invalid Query Syntax 
The query could not be understood due to a syntax error.
20207
Unauthorized Query 
The query could not be executed because it refers to a field to which the supplied login does not grant access.
20208
Maximum Records Exceeded 
Operation successful, but all of the records have not been returned. This reply code indicates that the maximum records allowed to be returned by the server have been exceeded. Note: reaching/exceeding the "Limit" value in the client request is not a cause for the server to generate this error.
20209
Timeout 
The request timed out while executing
20210
Too many outstanding queries 
The user has too many outstanding queries and new queries will not be accepted at this time.
20211
Query too complex 
The query is too complex to be processed. For example, the query contains too many nesting levels or too many values for a lookup field.
20212
Invalid key request 
The transaction does not meet the server's requirements for the use of the Key option.
20213
Invalid Key 
The transaction uses a key that is incorrect or is no longer valid. Servers are not required to detect all possible invalid key values.
20514
Requested DTD version unavailable. 
The client has requested the metadata in STANDARD-XML format using a DTD version that the server cannot provide.

Example of a RETS Query and its Explanation


Please got to the following link to get the full list of  Query language BNF


Here is a small example and its explanation is in below
Example:

Query=(ST=|ACT,SOLD),
(LP=200000-350000),
(STR=RIVER*),
(STYLE=RANCH),
(EXT=WTRFRNT,DOCK),
(LDATE=2000-03-01),
(REM=FORECLOSE),
(TYPE=~CONDO,TWNHME),
(OWNER=P?LE)

Verbally, this would be interpreted as "return properties with (ST equal ACT or SOLD) and (LP between 200000 and 350000, inclusive) and (STRbeginning with RIVER) and (STYLE equal RANCH) and (EXT equal WTRFRNT and DOCK) and (LDATE greater than or equal to 2000-03-01) and (REMcontaining FORECLOSE) and (TYPE not equal to CONDO and not equal to TWNHME) and (OWNER starting with P and having LE in the 3rd and 4th characters)."

I hope this will help lots of People who are working with RETS and don't know how to make query to RETS server.

How to install MongoDB on MAC and integrate it with CodeIgniter

You can easily install MongoDB on you mac using MacPorts


MacPorts

MacPorts distributes build scripts that allow you to easily build packages and their dependencies on your own system. The compilation process can take significant period of time depending on your system’s capabilities and existing dependencies. Issue the following command in the system shell:


port install mongodb


Using MongoDB from Homebrew and MacPorts

The packages installed with Homebrew and MacPorts contain no control scripts or interaction with the system’s process manager.
If you have configured Homebrew and MacPorts correctly, including setting your PATH, the MongoDB applications and utilities will be accessible from the system shell. Start the mongod process in a terminal (for testing or development) or using a process management tool.
mongod
Then open the mongo shell by issuing the following command at the system prompt:
mongo
This will connect to the database running on the localhost interface by default. At the mongo prompt, issue the following two commands to insert a record in the “test” collection of the (default) “test” database and then retrieve that record.
> db.test.save( { a: 1 } ) > db.test.find()
The key part is grabbing the driver binary here: https://github.com/mongodb/mongo-php-driver/downloads
For MAC download your version
  1. Binary for OS X running PHP 5.2

    osx-php52-1.0.11.zip

    Binary for OS X running PHP 5.3

  2. osx-php5.3-1.0.11.zip

Now unzip the downloaded file and copy the mongo.so file to extension folder

/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626
Open php.ini file and copy the following code and restart your web server.
extension=mongo.so


Integration MongoDB in Codeigniter

For CodeIgniter there are a few community-built MongoDB libraries you can use. Since I checked almost all of them, use CodeIgniter MongoDB Active Record. Here's a sample code:


// Load MongoDB library 
$this->load->library('mongo_db'); // Query MongoDB: Active document library usage example
$docs = $this->mongo_db->where('age', '33')->get('collection_name_here');

How to edit the php.ini file in MAMP(MAC)

Select PHPinfo on your start screen of MAMP to see which version is running on your machine before editing or you may end up editing the wrong php.ini file. Once on the phpInfo page do a search for “php.ini” and look at the file location. Second, Depending on your php.ini settings, everyone uses different ones, you MUST restart MAMP for the changes to show up.

Where is the php.ini file located?

/Applications/MAMP/bin/php/php5.2.17/conf/php.ini
or
/Applications/MAMP/bin/php/php5.3.6/conf/php.ini


Tuesday, April 23, 2013

Make label text in center for Google Maps API v3 marker with label

I am using Google Maps API v3 marker with label in one of my project. Here is the link of basic example what I am talking about.
I got stuck making the label center of the marker image. After spending some time I got the simple solution..


.labels{
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    opacity: 1;
    pointer-events: none;
    text-align: center;
    width: 60px;
    white-space: nowrap;
}
function initialize() {
        map = new google.maps.Map(document.getElementById("map"), mapOptions);
        var marker = new MarkerWithLabel({
          position: new google.maps.LatLng(0,0),
          draggable: true,
          map: map,
          labelContent: "example",
          labelAnchor: new google.maps.Point(30, 0),
          labelClass: "labels", // the CSS class for the label
          labelStyle: {opacity: 0.75}
        });

      }


You can make the label float above the marker pushpin with an anchor point like new google.maps.Point(20, 50)

Tuesday, April 9, 2013

Integrate Remote Data using select2

I was trying to integrate the Select2 plugin for remote data. Select2 comes with AJAX/JSONP support built in. I am using this plugin for the first time. I followed the reference code from the following link  to write my code.

http://ivaynberg.github.io/select2/#ajax

HTML input should be a hidden input if you want to use a ajax function.

JavasSript code are as follows

$(document).ready(function () {



function format_city(obj){
            return obj.City;
}

$("#select_city").select2({
            minimumInputLength: 2,
            placeholder: 'Type in City Names...',
            multiple:true,
            ajax: { 
                url: base_url+"property/getCities",
                dataType: 'json',
                data: function (term) {
                    return {
                        q: term, // search term
                        page_limit: 10
                    };
                },
                results: function (data) { 
                    return {results: data, text:'City'};
                    
                }
            },
            formatResult: format_city, 
            formatSelection: format_city
            
        });
});

My Ajax function return json value. which contains data like  [{City:'Anderson',City:'New York'}]


ajax: { 
    url: base_url+"property/getCities",
    dataType: 'json',
    data: function (term) {
          return {
             q: term, // search term
             page_limit: 10
           };
        },
        results: function (data) { 
        return {results: data, text:'City'};
    }}


When I run the script it was not working properly. I spend almost 1 hours and after that come to know the big issue. Actually result of json data requires a "id". if in the result its not found that it will not work.

I have added the following code


$("#select_city").select2({
.....
id: function(obj) {
    return obj.City; // use slug field for id
},
.....
});

Saturday, April 6, 2013

Add Marker with Label for Google Maps API V3



For last couple of days I was searching for Google Map Marker with Label functionality then I found the following PHP class in PHP Google Maps API. I did use this class for both CakePHP and conventional PHP.

This class really help me to integrate the goole map advance features easily in my real estate application. but one feature was missing in the library and that was Label in marker. 

I need that label to show the property price in the marker. I start searching for the feature and finally I found it in the following address

http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.8/docs/examples.html

After 1-2 hours dig down in the script I have decided to integrate this feature in the PHP Google Maps API.

What I did is here I am trying to share with you...

Added the following variables for the class..

var $marker_with_label = true;

var $marker_label_js = "js/gmap/markerwithlabel.js";


Update the functions as like below


function getHeaderJS() { 
    if($this->marker_with_label){
    $_headerJS .= "";
    }
}

function getUtilityFunctions(){
   $_script = "";
   if(!empty($this->_markers)&& $this->marker_with_label)
    $_script .= $this->getCreateMarkerWithLabelJS();
         else
             $_script .= $this->getCreateMarkerJS();
}

function getAddMarkersJS($map_id = "", $pano= false) {
  //defaults
  if($map_id == ""){
   $map_id = $this->map_id;
  }
  
  if($pano==false){
   $_prefix = "map";
  }else{
   $_prefix = "panorama".$this->street_view_dom_id;
  }
        $_output = '';
        foreach($this->_markers as $_marker) {

            $iw_html = str_replace('"','\"',str_replace(array("\n", "\r"), "", $_marker['html']));
            $_output .= "var point = new google.maps.LatLng(".$_marker['lat'].",".$_marker['lon'].");\n";
            if($this->marker_with_label){
                $_output .= sprintf('%s.push(createMarkerWithLabel(%s%s, point,"%s","%s", %s, %s, "%s", %s, "%s" ));',
                    (($pano==true)?$_prefix:"")."markers".$map_id,
                    $_prefix,
                    $map_id,
                    str_replace('"','\"',$_marker['title']),
                    str_replace('/','\/',$iw_html),
                    (isset($_marker["icon_key"]))?"icon".$map_id."['".$_marker["icon_key"]."'].image":"''",
                    (isset($_marker["icon_key"])&&isset($_marker["shadow_icon"]))?"icon".$map_id."['".$_marker["icon_key"]."'].shadow":"''",
                    (($this->sidebar)?$this->sidebar_id:""),
                    ((isset($_marker["openers"])&&count($_marker["openers"])>0)?json_encode($_marker["openers"]):"''"),
                    (string)$_marker['price']
                ) . "\n";
            }
           else
           {
               $_output .= sprintf('%s.push(createMarker(%s%s, point,"%s","%s", %s, %s, "%s", %s ));',
                   (($pano==true)?$_prefix:"")."markers".$map_id,
                   $_prefix,
                   $map_id,
                   str_replace('"','\"',$_marker['title']),
                   str_replace('/','\/',$iw_html),
                   (isset($_marker["icon_key"]))?"icon".$map_id."['".$_marker["icon_key"]."'].image":"''",
                   (isset($_marker["icon_key"])&&isset($_marker["shadow_icon"]))?"icon".$map_id."['".$_marker["icon_key"]."'].shadow":"''",
                   (($this->sidebar)?$this->sidebar_id:""),
                   ((isset($_marker["openers"])&&count($_marker["openers"])>0)?json_encode($_marker["openers"]):"''")
               ) . "\n";
           }


        }
        
        if($this->marker_clusterer && $pano==false){//only do marker clusterer for map, not streetview
         $_output .= "
            markerClusterer".$map_id." = new MarkerClusterer(".$_prefix.$map_id.", markers".$map_id.", {
            maxZoom: ".$this->marker_clusterer_options["maxZoom"].",
            gridSize: ".$this->marker_clusterer_options["gridSize"].",
            styles: ".$this->marker_clusterer_options["styles"]."
          });
           
         ";
        }
        return $_output;
    }

function getCreateMarkerWithLabelJS(){
        $_output = "
        function createMarkerWithLabel(map, point, title, html, icon, icon_shadow, sidebar_id, openers,label){

        var marker1 = new MarkerWithLabel({
                   position: point,
                   map: map,
                   labelContent:'$'+label ,
                   labelAnchor: new google.maps.Point(22, 10),
                   labelClass: 'labels', // the CSS class for the label
                   icon:icon,
                   shadow:icon_shadow
                 });

       //if(icon!=''){marker_options.icon = icon;}
       //if(icon_shadow!=''){marker_options.shadow = icon_shadow;}

       //create marker
       //var new_marker = new google.maps.Marker(marker_options);
       if(html!=''){
     ".(($this->info_window)?"

           google.maps.event.addListener(marker1, '".$this->window_trigger."', function() {
              infowindow.close();
              infowindow.setContent(html);
              infowindow.open(map,marker1);
           });

     if(openers != ''&&!isEmpty(openers)){
              for(var i in openers){
                var opener = document.getElementById(openers[i]);
                opener.on".$this->window_trigger." = function() {

                 infowindow.close();
                 infowindow.setContent(html);
                 infowindow.open(map,marker1);

               return false;
                };
              }
           }
     ":"")."
           if(sidebar_id != ''){
               var sidebar = document.getElementById(sidebar_id);
      if(sidebar!=null && sidebar!=undefined && title!=null && title!=''){
       var newlink = document.createElement('a');
       ".(($this->info_window)?"
             newlink.onclick=function(){infowindow.open(map,marker1); return false};
       ":"
       newlink.onclick=function(){map.setCenter(point); return false};
       ")."
       newlink.innerHTML = title;
       sidebar.appendChild(newlink);
      }
           }
                }
       return marker1;
   }
     ";
        return $_output;
    }

function addMarkerByAddress($address,$title = '',$html = '',$price='',$tooltip = '', $icon_filename = '', $icon_shadow_filename='') {
        if(($_geocode = $this->getGeocode($address)) === false)
            return false;
        return $this->addMarkerByCoords($_geocode['lon'],$_geocode['lat'],$title,$html,$price,$tooltip, $icon_filename, $icon_shadow_filename);
    }

function addMarkerByCoords($lon,$lat,$title = '',$html = '',$price,$tooltip = '', $icon_filename = '', $icon_shadow_filename='') {
        $_marker['lon'] = $lon;
        $_marker['lat'] = $lat;
        $_marker['html'] = (is_array($html) || strlen($html) > 0) ? $html : $title;
        $_marker['title'] = $title;
        $_marker['tooltip'] = $tooltip;
        $_marker['price'] = (string)$price;

        if($icon_filename!=""){
            $_marker['icon_key'] = $this->setMarkerIconKey($icon_filename, $icon_shadow_filename);
            if($icon_shadow_filename!=""){
               $_marker['shadow_icon']=1;
            }   
        }else if( $this->default_icon != ''){
         $_marker['icon_key'] = $this->setMarkerIconKey($this->default_icon, $this->default_icon_shadow);
         if($this->default_icon_shadow!=""){
            $_marker['shadow_icon']=1;
         }
        }        
        $this->_markers[] = $_marker;
        $this->adjustCenterCoords($_marker['lon'],$_marker['lat']);
        // return index of marker
        return count($this->_markers) - 1;
    }



I know its lots of code here. But all you have to do search the functions and replace the function with the above functions...

Now you have to change few more code which you will call by map object.


 $gmap = new GoogleMap();
 $gmap->addMarkerByCoords($LONGITUDE, $LATITUDE, $title, $html_info_window_data,'your label text');