Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Get BodyId value in an extension

edited February 2007 in Vanilla 1.0 Help
How would I get the contents of the BodyId variable so that I could decide what to do depending upon what page I was on? I specifically need to identify what body tag id I am on.

Comments

  • $GLOBALS['Head']->BodyId ? (or directly as $Head->BodyId if you're already in the global scope)
  • edited February 2007
    That's a better way than what I started to do which was to check the php page I was on and then load a variable with the body tag id. I tried the $head->BodyId but it was empty. Let me try the global reference. Thank you.

    Edit: The global reference was empty, too. What would I need to add?
  • ah, dosn't look like you can without a delegate somewhere. the bodyid variable is set after the extensions are included.
  • edited February 2007
    Perhaps
    function GetBodyID(&$Head) { $Head->Contex->PassThroughVars['BodyId'] = &$Head->BodyId; } $Context->AddToDelegate('Head', 'PreRender', 'GetBodyID');

    and then wherever you are, you should be able to $BodyID = &$Context->PassThroughVars['BodyID'];
  • That didn't work either. So, I used the basic "if" statement that is used in each extension to tell it where to operate. I then load a variable with the body id tag for that page, e.g. index.php had a body id of DiscussionsPage. Now, my extension works and I can release it. Thank you.
This discussion has been closed.