Adding Phoogle to your site |
[eluser]floweringmind88[/eluser]
http://www.systemsevendesigns.com/phoogle Phoogle is an easy way to add google maps to your site. I recently added it to my site and thought I would share the steps for integrating it into CodeIgniter as some asked me about it. Attached is my modified version so that it works in the libraries directory. Here is my code for the controller, you will need to get your own apikey from google: class Stadium extends Controller { function Welcome() { parent::Controller(); } function index($letter = NULL) { error_reporting(E_ALL ^ E_NOTICE); $dataarr = array(); $dataarr['letter'] = $letter; $dataarr['baseurl'] = base_url(); $this->load->library('phoogle'); $this->phoogle->setAPIKey("ABQIAAAAFwL0dcVBl8P3ctLK2UPZpRTwyyyNgDoMoQlEr_yhAHAGj7xDVBTQT0wx46ZbzxuY9jzBWGVyV2GySA"); $this->load->view('header'); $this->load->view('stadium',$dataarr); $this->load->view('footer'); } } Finally here is my view: $this->phoogle->printGoogleJS(); $this->phoogle->addAddress('4000 E Quincy Ave, Englewood, CO 80113', '<b>Kent Denver Stadium</b>'); $this->phoogle->setHeight('476'); $this->phoogle->setWidth('742'); $this->phoogle->showMap(); Hope you find it useful! Chris
[eluser]codelearn[/eluser]
Thanks again! FYI: if you are getting this error: Quote:Fatal error: Cannot use string offset as an array in .... phoogle.php on line 132 Use this fix... Comment out the following lines of code in phoogle.php: Code: $results = $this->xml2array(utf8_encode($addressData)); Replace with this: Code: $xml = new SimpleXMLElement(utf8_encode($addressData)); From http://forums.digitalpoint.com/showthread.php?p=9772549 |
Welcome Guest, Not a member yet? Register Sign In |