[SOLVED] Different BODY ONLOAD tags on different pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
finster

[SOLVED] Different BODY ONLOAD tags on different pages

Post by finster »

Hello all,

I'm trying to show a Google Map on one of my pages, like in this example http://code.google.com/apis/maps/documentation/examples/map-simple.html.

So far I've: -
  • Put the javascript into the META section of my "location" page, wrapped in {literal}s. - works OK.
  • Created a Global Content Block that contains the "map_canvas" DIV. - works OK.
My issue is how I add   

Code: Select all

</__body onload="initialize()" onunload="GUnload()">
to my "location" page but none of the other pages (as they don't have the javascript function on them). So far I have two templates, one with the plain BODY and one with the extra function call but I'd prefer to use just one template if possible.

Has anybody got any ideas?

Thanks...
Last edited by finster on Tue Oct 14, 2008 5:27 pm, edited 1 time in total.
nhaack

Re: Different BODY ONLOAD tags on different pages

Post by nhaack »

Have you tried something like:

Code: Select all

</__body {content block="html_body_extension" oneline="true"}>
in your template? This way you get an extra field in your page editing dialog in which you can fill your

Code: Select all

onload="initialize()" onunload="GUnload()"
Works for me :)

Best
Nils
finster

[SOLVED] Different BODY ONLOAD tags on different pages

Post by finster »

Brilliant, thanks. Just what I was after.

Hadn't heard of the "content block" before - I'll have to read up on it!

Works perfectly - thanks again.
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Different BODY ONLOAD tags on different pages

Post by jack4ya »

Good for you!
Add [SOLVED] to you topic title then, please.
viebig

Re: Different BODY ONLOAD tags on different pages

Post by viebig »

also you can skip global content blocks using something like:

Code: Select all

</__body{if $page_alias=='maps'} onload="initialize()" onunload="GUnload()"{/if}>
just an addictional way to do that.
finster

Re: Different BODY ONLOAD tags on different pages

Post by finster »

jack4ya wrote: Good for you!
Add [SOLVED] to you topic title then, please.
Sorry, thought I had done but it was just the title of a post that I'd changed, not the topic.

Thanks again all...
Locked

Return to “CMSMS Core”