That's right! I have finally decided to release the famous Code Index that I created for my forums, Simple Machine Codes and Revolution X!
Please note: This code isn't just for Coding boards, so use your imagination
It's is mainly just to index topics, to make it easier to go through
the set up is really quite simple, just a couple of steps:
Step 1: jQuery - Add this to the top of your headers if you don't have it already
<script type="text/javascript" src="/jquary.js"></script>
Step 2: The Main Code - Add to footers
<script type="text/javascript">
function CIv4(title,board,index){
/*
Code Index Created by Agent Moose
Released on: 4/30/2010
*/
if(location.href.match("." + index)){
document.title = title;
var navigation = $("div.nav").html();
var pages = $("tr td.middletext").html();
var online = $("tr.windowbg2 td[colspan='8']").html();
var Search = "<div class='catbg' style='padding: 5px 5px 5px 10px;'>Search " + title + "</div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='titlebg' width='100%'>Search</td></tr><tr><td class='windowbg2' width='100%'><center><form id='searchform' name='searchform' accept-charset='ISO-8859-1' method='post' action='" + smf_scripturl + "?action=search2'><input type='text' size='40' name='search' id='Index'/><input id='brd" + board + "' type='hidden' checked='checked' value='" + board + "' name='brd[" + board + "]'/><input type='submit' value='Search' name='submit'/></form></center></td></tr></table></div>";
$("img[alt='New'],#news_box,#bodyarea").hide();
$("#bodyarea").before("<br /><div class='nav' style='font-size: smaller; margin-bottom: 2ex; margin-top: 2ex;'>" + navigation + " > <b><a class='nav' href='" + smf_scripturl + "/board," + board + ".0." + index + "/sort,subject.html'>Code Index</a></b></div><br/><div class='tborder'>" + Search + "<br/><div class='tborder'><div class='catbg' style='padding: 5px 5px 5px 10px;'>" + title + " - <span class='smalltext'>Sort By: <a href='" + location.pathname + "/board," + board + ".0." + index + "/sort,replies/desc.html'>Replies</a> | <a href='" + smf_scripturl + "/board," + board+ ".0." + index + "/sort,views/desc.html'>Views</a> | <a href='" + smf_scripturl + "/board,"+ board + ".0." + index + "/sort,subject.html'>Subject</a></span></div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='titlebg2' colspan='5'>" + online + "</td></tr><tr><td class='titlebg2' colspan='5'>" + pages + "</td></tr><tr id='Codes' align='right'><td class='windowbg' colspan='2'><span class='smalltext'>© Code Index created by Agent Moose.</span></td></tr><tr><td class='titlebg2' colspan='5'>" + pages + "</td></tr></table>");
var Codes = document.getElementsByTagName("span");
for(x=0;x<Codes.length;x++){
if(Codes[x].id.match(/msg/i) && Codes[x].parentNode.className == "windowbg"){
var topic = Codes[x].innerHTML;
var creator = $(Codes[x]).parent().next().html();
$("#Codes").before("<tr><td class='windowbg2' width='50%'>" + topic + "</td><td class='windowbg2' width='50%'>" + creator + "</td></tr>");
};};
for(r=0;w = document.links;r++){
if(w[r].href.match(/\/sort,/i) && !w[r].href.match("." + index + "/sort,")){
w[r].href = w[r].href.replace("/sort,subject","." + index + "/sort,subject");
w[r].href = w[r].href.replace("/sort,starter","." + index + "/sort,starter");
w[r].href = w[r].href.replace("/sort,replies","." + index+"/sort,replies") ;
w[r].href = w[r].href.replace("/sort,views","." + index + "/sort,views");
};
if(w[r].href.match(/#bot/i)) w[r].style.display = "none";
};};};
CIv4("TITLE","BOARD ID","EXTENSION");
</script>
TITLE = The Title of the Index (EX: SMC Code Index)
BOARD ID = AKA Board Number you want to index.
EXTENSION = Tells which index you are on. (EX: for the SMC Code Index, it could be smcindex. For a theme index, it could be themeindex. NO SPACES ALLOWED!)
You may add more of these lines:
CIv4("TITLE","BOARD ID","EXTENSION");
Step 3: the Child Board - Creating the Child Board (optional)
Please note that you don't have to create a new child board each time you want to have another Index. The Child Board is there to link to the index. If you want to just give out a link instead of making a new child board, use this:
http://XXXXXX.smfforfreeX.com/index.php/BOARD_ID.0.EXTENSION/sort,subject.html
All you have to do is replace whats in all caps
(The X's, BOARD_ID and EXTENSION which is exactly the same as you put above)
Childboard Setup - Create a child board (add it to the board you want the index to be on)
- Use the following code as your "Full Name" Option
</a><a href="/index.php/board,BOARD_ID.0.EXTENSION/sort,subject.html">TITLE</a>
BOARD_ID = The Board ID/number of the board you want to index.
EXTENSION = place the same EXTENSION you used above.
TITLE = The title of the index (just like above)
- The rest of the information you can fill in as you wish. You just need to edit the "Full Name" Option.
And that's it! If you had done everything correctly, you would have something that looks similar to this:
http://smcodes.smfforfree3.com/index.php/board,8.0.smcindex/sort,subject.htmlEnjoy