Arsip Tag: php

Google Map API v3 Biostall Libary

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

Download: https://github.com/BIOSTALL/CodeIgniter-Google-Maps-V3-API-Library/archive/master.zip

  • Download library (ukuran ~ 190KB)
  • Paste di direktori Application/libraries. Ada dua file, Googlemaps.php dan Jsmin.php
  • Pada file view.php (atau file apapun untuk menampilkan map) sebelum tag </head> paste script di bawah ini

<?php echo $map['js']; ?>

  • dan paste script di bawah ini untuk menampilkan map di antara tag <body> dan </body>

<?php echo $map['js']; ?>

PHP 7.0:  Error Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

jika Anda memakai PHP7 maka akan ada error di baris atas website seperti ini

pada file Application/libraries/Googlemaps.php

ubah baris di bawah ini


function Googlemaps($config = array()) {

menjadi seperti ini


function __construct($config = array()) {

tampilan editornya

CodeIgniter HMVC object_to_array() error

HMVC : https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/downloads

Muncul error

An uncaught Exception was encountered

Type: Error

Message: Call to undefined method MY_Loader::_ci_object_to_array()

Filename: /Users/k1ut2/Sites/nine.dev/application/third_party/MX/Loader.php

Line Number: 300

Backtrace:

File: /Users/k1ut2/Sites/nine.dev/application/controllers/Welcome.php Line: 23 Function: view

File: /Users/k1ut2/Sites/nine.dev/index.php Line: 315 Function: require_once

Solusi:

pada file application/third_party/MX/Loader.php (sekitar line 300…)


return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));

replace dengan script di bawah ini


if (method_exists($this, '_ci_object_to_array'))
{
 return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
} else {
 return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return));
}