Beldion
Beldion

Reputation: 331

How to put google map API in codeigniter?

I got my library from

http://biostall.com/codeigniter-google-maps-v3-api-library

and followed the instructions in

http://biostall.com/demos/google-maps-v3-api-codeigniter-library/

but i am receiving an error message

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Googlemaps has a deprecated constructor

Filename: libraries/Googlemaps.php

Line Number: 16

Backtrace:

File: C:\xampp\htdocs\test_map\application\controllers\Welcome.php
Line: 25
Function: library

File: C:\xampp\htdocs\test_map\index.php
Line: 292
Function: require_once

Anyone knows how to solve this problem?

Upvotes: 1

Views: 6752

Answers (2)

Alexandra
Alexandra

Reputation: 1

You need to change the name of class with CI_Googlemaps and the name of constructor with __construct

Upvotes: 0

Tpojka
Tpojka

Reputation: 7111

Try with renaming

function Googlemaps($config = array())
{
    if (count($config) > 0)
    {
        $this->initialize($config);
    }
    log_message('debug', "Google Maps Class Initialized");
}

to

function __construct($config = array())
{
    if (count($config) > 0)
    {
        $this->initialize($config);
    }
    log_message('debug', "Google Maps Class Initialized");
}

If doesn't work, than library probably needs more code changes since it is code older than 2-3 years.

Upvotes: 5

Related Questions