views:

392

answers:

1

Hello,

I am having an error when I try to display googlemaps

If I load the googlemaps javascript source

I get this error in firebug

syntax error
[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\nmaps?fil...sor=false (regel 1)

I have this to load the file

<?php if (isset($gmap))?><script type="text/javascript" src="<?php echo __PUBLIEK_PAD; ?>/js/<?php echo $gmap; ?>"></script>

and here is how I set the variables

$key='my-api-key';
$this->view->gmap="http://maps.google.com/maps?file=api&amp;v=2&amp;key=".$key."&amp;sensor=false";
$this->view->js_gmaptest = 'gmaptest.js';

Is there something in here that can cause the problem? I had it working before, but know I don't know anymore.

thanks, richard

+2  A: 

Not sure if it's the problem, but the documentation says the beginning of your document should look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
karim79
I looked some more in firebug, and if you loot at the source off the googlemaps script, then it gives back my own layout page and it seems it's been redirected to my page not found page. I don't know about this, like I said it was working before. I will check my api key first, maybe it's not getting threw to googlemaps?
Richard
It looks like your __PUBLIEK_PAD variable points to a non-existent URL. Firebug is expecting that URL to point to a file that contains Javascript but what it gets back is a 404 error written in HTML. Firebug complains about the <DOCTYPE> of that 404 page because it's not valid Javascript. It's not an API key problem.
Mike Williams
thanks both, it actually came down to setting the source right.It's due to some copy/paste that I did. I accidently messed up the code.
Richard