<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true"><br></div><div><div>On Jul 1, 2014, at 12:18 PM, michael paulukonis <<a href="mailto:xraysmalevich@gmail.com">xraysmalevich@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div><div><div><div>re: <a href="http://pmwiki.org/wiki/Cookbook/Toggle">http://pmwiki.org/wiki/Cookbook/Toggle</a><br><br>In the toggle.php recipe of 2014-02-21, we see the following:<br><br>$HTMLFooterFmt['toggle'] = "<script type=\"text/javascript\">document.getElementById(\"{$id}\").style.display = '{$style}';</script>";<br>

<br></div>This should create a simple string that is places into the HTMLFooterFmt hash with the index of "toggle."<br><br></div>How on earth is toggle supposed to function if there is more than one toggle present on the page?</div></div></div></div></div></blockquote><div><br></div>If you have more than one toggle, make sure they all have a different id. :)</div><div><br></div><div>I've used this recipe several times, and I love it.  It works very well.  When I used it with (:panelist:) for quizzes, I made sure to use a variable from the page (say $Name) as the index.</div><div><br></div><div>Example of a quiz at work, entirely PmWiki driven -- each quiz's info is stored in data pages elsewhere on the site, they have categories and are pulled into various pages of the website...  <a href="http://bte18.com/Main/GolfingBasics">http://bte18.com/Main/GolfingBasics</a>  So you can see the different calls to the toggle javascript code on the HTML end here.<br><br><blockquote type="cite"><div dir="ltr"><div><div><div><div>Am I missing something in PHP/PmWiki that would allow this to work?</div></div></div></div></div></blockquote><div dir="ltr"><div><div><div><br></div></div></div><div>It's a combo of PmWiki and Javascript at work here.  :)</div><div><br></div></div><blockquote type="cite"><div dir="ltr"><div><div>We don't see anything like this behavior in the older version from 2009-07-23<br><br></div>Perhaps not coincidentally, I have multiple toggles working with the version from 2009-07-23, but not with 2013-02-21<br>

<br></div>Unless I make the following change:<br><br>  $HTMLFooterFmt["toggle$id"] = "<script type=\"text/javascript\">document.getElementById(\"{$id}\").style.display = '{$style}';</script>";</div></blockquote><br></div><div>Try the same line in the toggle.php I got from the cookbook (years ago):</div><div>$HTMLFooterFmt[] = "<script type=\"text/javascript\">document.getElementById(\"{$id}\").style.display = '{$style}';</script>";</div><div><br></div><div>The moment that you name it ['toggle'] it will only make one entry in $HTMLFooterFmt.  with the [] it will just append them all to the array with numbered indexes.</div><div><br></div><div>If you want them indexed "toggle" then yes they need unique $id appended to 'toggle" so each index is unique... which is exactly what you said worked.</div></body></html>