I've added a javascript function to an existing script file used by the template and specified within overall_header.tpl.
I've modified add_attachment_body.tpl and posting_poll_body.tpl to have a checkbox with an onclick action that call the javascript function and a div which is not displayed initially.
The problem I'm having is that while these changes to the template file work perfectly when it's saved as HTML locally, but they do not work at all when phpBB creates the page. The section is always displayed and the checkbox seems to have no effect whatsoever.
I've looked at several "collapsible" mods (Faq, Rules, Categories) and they all seem far more complex so I haven't been able to learn anything from them except that they seem to take a totally different (not javascript) approach. My forum is for a small community, everyone uses windows and has either IE6 or 7 or Firefox 2, I have no need for any further level of compatibility.
overall_header.tpl contains:
Code: Select all
<script language="javascript" type="text/javascript" src="templates/cs/scripts.js"></script>
Code: Select all
function toggle(id)
{
el = document.getElementById(id);
var display = el.style.display ? '' : 'none';
el.style.display = display;
}
Code: Select all
<tr>
<th class="thHead" colspan="2"><input type=checkbox onclick="toggle('ShowPollYN')">{L_ADD_A_POLL}</th>
</tr>
<div id="ShowPollYN" style="display:none">
.
.
.
</div>
Code: Select all
<tr>
<th class="thHead" colspan="2"><input type=checkbox onclick="toggle('ShowAttachYN')">{L_ADD_ATTACH_TITLE}</th>
</tr>
<div id="ShowAttachYN" style="display:none">
.
.
.
</div>
phpBB version 2.0.22....* @package attachment_mod
* @version $Id: attachment_mod.php,v 1.6 2005/11/06 18:35:43 acydburn Exp $
* @copyright (c) 2002 Meik Sievertsen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License