I'm designing a tab menu using the sliding doors technique which uses a different id in each section for the body. I'd like to be able to give a different id to the body depending on which section the content it's currently at.

I don't know if this is possible, but I noticed the {onload_attributes} item tag in Xtemplate and I was wondering if I could modify the contents anywhere, but couldn't find it in the admin area.

Any ideas?

Thanks

Comments

dublin drupaller’s picture

Am a newbie but I'm almost certain you have to edit the xtemplate file directly to add in your onload_attributes, i.e. you cannot add it in using the admin interface.

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

javanaut’s picture

Modules can define content to be placed in the onload attribute dynamically. This template variable renders that dynamic content.

You could append to this by creating a small module that implements the onload hook. This approach is probably more difficult than it needs to be, but AFAIK, the current theme mechanism doesn't have a simple solution for you.

If you replace the {onload_attributes} with something hard coded, you run the risk of having modules misbehave because their javascript didn't load properly. If none of the modules you're using implement the onload hook, then you're probably safe in hard-coding something in there.

aletheia-1’s picture

Thanks Javanaut,
your whole post is really instructing. I dindn't know about the drupaldocs.org page.
I searched my modules but didn't find any using the onload hook. Do you know of any module that does what I need or know where I could learn how to use the onload hook to do that?

nedjo’s picture

... where it looks like this:


function htmlarea_onload() {
  if (_htmlarea_is_changed()) {
    return array("HTMLArea.init()");
  }
  return array();
}

jessearana’s picture

<body style="background-color:red;" {onload_attributes}>

works.

just change red to whatever color you want. So I assume any CSS style attrib will work.