What I'm working on is changing the Forum Rules, in some places, from the actual list of rules, to a link that will pop up a window with the rules there. Sort of like the Get More link in the smilies box.
The specific problem I'm having is getting the forumid through the system, so it will be able to figure out just what exactly the rules are.
That operates a custom function that I've put in the vbcode.js file:
PHP Code:
function showforumrules(x,y,sessionhash) {
window.open("misc.php?action=showforumrules&forumid=$forum[forumid]&s="+sessionhash, "smilies", "toolbar=no,scrollbars=yes,resizable=yes,width="+x+",height="+y);
}
Which in turns works with some custom code I've put in the misc.php file:
PHP Code:
if ($action=="showforumrules") {
$templatesused = ""; // Only one template used so load it when called
include("./global.php");
$forumid=verifyid("forum",$forumid);
$foruminfo=getforuminfo($forumid);
$bbcodeon=iif($foruminfo[allowbbcode],$ontext,$offtext);
$imgcodeon=iif($foruminfo[allowimages],$ontext,$offtext);
$htmlcodeon=iif($foruminfo[allowhtml],$ontext,$offtext);
$smilieson=iif($foruminfo[allowsmilies],$ontext,$offtext);
eval("dooutput(\"".gettemplate("showforumrules")."\");");
}
This uses a custom template I created, showforumrules: (I've removed most of the formatting for simplicity)
PHP Code:
<b>Forum Rules</b><br>
You <b>may $rules[postnew]</b> post new threads.<br>
You <b>may $rules[postreply]</b> post replies.<br>
You <b>may $rules[attachment]</b> post attachments.<br>
You <b>may $rules[edit]</b> edit your posts.<br>
<br>
<b>Posting Rules</b><br>
HTML code is <b>$htmlcodeon</b>.<br>
<a href="misc.php?s=$session[sessionhash]&action=showsmilies">Smilies</a> are <b>$smilieson</b>.<br>
<a href="misc.php?s=$session[sessionhash]&action=bbcode">vB code</a> is <b>$bbcodeon</b>.<br>
[IMG] code is <b>$imgcodeon</b>.
I also had to add the following to the forumdisplay template, or else the link would not work:
The specific problem I am having is with the bit that I've put in the vbcode.js file. I've tried to use &forumid=$forum[forumid] to pass the forumid along to the code I put in misc.php, but it's not working. Now if I take out &forumid=$forum[forumid] and just hardcode a forumid number, like &forumid=1, then it works fine, but that's not the best way. It should be able to get the forumid through the variable, but it isn't working.