WordPress.org

Ready to get started?Download WordPress

Forums

Embedding a javascript google guestmap: how to fire an onload (5 posts)

  1. digitaltoast
    Member
    Posted 7 years ago #

    I'm trying to embed this guestmap:
    http://www.thompsonbd.com/guestmap.php into WordPress 2.0.4

    To this end, I've read all of the below and many more in the last couple of days:
    http://codex.wordpress.org/Pages#Page_Templates
    http://wordpress.org/support/topic/22160?replies=2
    http://rollerweblogger.org/wiki/Wiki.jsp?page=TwistyComments
    http://news.hping.org/comp.lang.javascript.archive/0126.html
    http://www.thompsonbd.com/forums/viewtopic.php?t=98
    http://www.galleryembedded.com/forums/viewtopic.php?p=14498#14498
    (the method mentioned in the last link was too ugly and stopped working after the guestmap was updated for API V2)

    So, the closest I could come up with was:
    http://www.horseriding-dunedin.co.nz/guestmap.txt
    which is just a modified version of the plugins template.
    It can be seen in non-action at:
    http://www.horseriding-dunedin.co.nz/trek/guestbook/

    The map loads fine, but try as I might (and oh, how I've tried!) I can't get the javascript and
    <body onload="onLoad()" onunload="GUnload()">
    parts to go in the right place.

    I've tried my best to learn on my own, but I think there's something fundamental about page wrapping I'm not understanding, and I'd greatly appreciate the assistance.

  2. I think you're close...

    The page template has a Get_header() call. This pulls in the standard header.php from your template. This (probably) includes a <body> tag. As your page template includes its own <body> tag (with the script), this isn't going to work.

    How about copying the contents of your header.php into your template, remove the get-header(), remove the extra <body> and try that?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    You also call get_header() twice in that template, which most definitely will not work.

    Probably your best bet is to eschew the get_header call entirely and copy the header in yourself. Not the best way to do things, but it would work for a one-shot deal.

  4. digitaltoast
    Member
    Posted 7 years ago #

    Well, I've done all the above, spent a couple of weeks with a headache, going to give up and ask for help again!

    The embedded guestmap is showing in Firefox but not clickable, but not in IE at all, but is giving a javascript error "pdmarker is not defined", and points me to this bit of code:

    var point0 = new GLatLng(53.33087298301704, -1.0546875);
    448 var marker0 = new PdMarker(point0, icon);

    You can see the problem at:
    http://www.horseriding-dunedin.co.nz/trek/guestbook/

    It would be a shame to abandon it altogether - perhaps someone more skilled than me could make a proper WordPress plugin out of it? Where would I suggest this kind of thing?

  5. digitaltoast
    Member
    Posted 7 years ago #

    Well, it's been 7 months. That developer has kind of given up on it and I'm looking for a decent Google Maps based guestmap, even if it can't be embedded in WordPress.
    I don't want to use an externally hosted on because they either disappear, or suddenly start flooding you with adverts!

Topic Closed

This topic has been closed to new replies.

About this Topic