Google Maps-contribution in the Wiki **SOLVED**

#1
[eluser]tobben[/eluser]
Hello to all,

I'm quite new to Code Igniter, a so called newbie Smile

My problem right now is in the Google Maps-implementation from a tutorial in the Wiki.

I'm starting to understand bits 'n pieces of the MVC-approach, but the Google Maps-example made me a bit uncertain.



My problem:

I've included both the API class and the Cigooglemapsapi.php-file in the Lib-folder.

And also put the HTML-part (the code in the bottom of http://codeigniter.com/wiki/Google_Maps/) in the Controllers-folder.


Right here is the problem.


Because, isnt that HTML-part supposed to be in the View-folder?

Than use a controller like:

Code:
<?php

class Googlemap extends Controller {

    function Googlemap()
    {
        parent::Controller();
    }
    
    function index()
    {
        $this->load->view('the_view_script');
    }
}
?>


Apparently, im doing something terrible wrong, because I don't get even a error-message. Only a blank page with no html or nothing.


Right now I'm clueless like Alicia Silverstone.



Thanks for any help.

#2
[eluser]zeedy2k[/eluser]
How did you fix this? Im just getting a blank page too.

#3
[eluser]zeedy2k[/eluser]
Got it... for anyone else having the problem I just put the following in controller instead of view:

Code:
$this->load->library('Cigooglemapapi');
$this->cigooglemapapi->setAPIKey('');
$this->cigooglemapapi->addMarkerByAddress('Address','Name','<b>Name</b>');

#4
[eluser]John_Betong[/eluser]
&nbsp;
I have followed all the links and managed to get GoogleMaps up and running here

If anyone is interested then here is the source code


Special Notes:

The source file is only the application folder so you will need to integrate CI's system folder.

The installation source files are on a subdomain of http://johns-jokes.com.

Cheers,

John

#5
[eluser]nmweb[/eluser]
I wrote the CI port of the library a long time ago. The example showed the syntax, it wasn't meant to be the way to code an application, just showcase syntax and usage.

There should be a new version out of the original library over at the Smarty forums. You can probably just replace the old class with the new one as long as you don't touch the extended Cigooglemapsapi class.

#6
[eluser]JOKERz[/eluser]
heres my controller

Code:
function maps(){
        $data['subtitle'] = 'Test map';
        
        $this->load->library('Cigooglemapapi');
        $this->cigooglemapapi->setAPIKey('myAPIkey');        
        $this->cigooglemapapi->width  = '800px';
        $this->cigooglemapapi->height = '300px';
        $this->cigooglemapapi->disableTypeControls();
        $this->cigooglemapapi->disableSidebar();
        $this->cigooglemapapi->disableDirections();
        $this->cigooglemapapi->setControlSize('small');
        $this->cigooglemapapi->setMarkerIcon(base_url().'icon.png',base_url().'/icon_shadow.png',13,30,20,1);
        
        $x='Brisbane';          
        $this->cigooglemapapi->addMarkerByAddress($x, $x, "myHTML content");
        $x='Milton Brisbane';          
        $this->cigooglemapapi->addMarkerByAddress($x, $x, array('title'=>'text values','title2'=>'text values2','title3'=>'text values3','title4'=>'text values4'));

        
        $data['HEAD_BFR'] = $this->cigooglemapapi->getHeaderJS().' '.$this->cigooglemapapi->getMapJS().'&lt;style type="text/css"&gt;
        v\:* {
        behavior:url(#default#VML);
        }
        &lt;/style&gt;';
        $data['HEAD_AFR'] = $this->cigooglemapapi->getOnLoad();
        $data['gMap'] = $this->cigooglemapapi->getMap();
        //i dont use sidebar
        //$data['sideBar'] = $this->cigooglemapapi->getSidebar();
        $this->load->view('maps', $data);
    }

$HEAD_BFR is place before &lt;/head&gt; tag, and $HEAD_AFR is place after &lt;body&gt;

hope it help Wink


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.