Post by $©Ø®Þ!@Ω™ on Apr 28, 2006 1:40:06 GMT
Now, I wouldn't call this a simple code. All the document.write() lines make it look simple, but it's really quite complex.
What does it do?
This code creates a three-column table.
Column 1:
Guests will see: "Welcome to Your Forum guest." Where "Your Forum" is an editable variable
Members will see: "Welcome back user." Where "user" is their display name, linked to the View-Profile page.
Column 2:
Guests and Members will see one of three different options displayed randomly each page-load.
The main admin and specified staff will see links to useful places in the Admin Area. i.e. The headers/footers area, general settings, etc.
More options can be added to each.
Column 3:
PM information is displayed here.
Guests will see "Please login or register." Where login and register are linked to the appropriate pages.
Members will see "PM Stats: X new out of X total." Where X is the number of new/total PMs linked to the PM page.
Now then, the code:
Created by: Scorpian
Tested? Yes
Cross-Browser? Yes
Preview: -link-
The Code:
Put at the top of your GLOBAL HEADERS to ensure it's right below the welcome table.
CUSTOMIZATION
There are two easy-edit things: The CSS and the variables.
CSS
That's the CSS portion. Change "#000066" to the color you'd like the background to be. If you'd like to use an image as the background, add this under the background-color line:
background-image:url(bground.gif);
JS VARIABLES
riBw is the width of your forum. It's set to the ProBoards standard by default. Most commonly used sizes are 700 and 728.
riBn is your forum's name.
What does it do?
This code creates a three-column table.
Column 1:
Guests will see: "Welcome to Your Forum guest." Where "Your Forum" is an editable variable
Members will see: "Welcome back user." Where "user" is their display name, linked to the View-Profile page.
Column 2:
Guests and Members will see one of three different options displayed randomly each page-load.
The main admin and specified staff will see links to useful places in the Admin Area. i.e. The headers/footers area, general settings, etc.
More options can be added to each.
Column 3:
PM information is displayed here.
Guests will see "Please login or register." Where login and register are linked to the appropriate pages.
Members will see "PM Stats: X new out of X total." Where X is the number of new/total PMs linked to the PM page.
Now then, the code:
Created by: Scorpian
Tested? Yes
Cross-Browser? Yes
Preview: -link-
The Code:
<style type='text/css'>
.riInfo{
background-color:#000066;
height:25px;
}
</style>
<script type='text/javascript'>
<!--
/*-------------------------------------------
Roddy Innovations Ultimate Info Bar
Created by Scorpian
http://roddyinnovations.co.nr
Do not redistribute w/o permission
Keep this header on at all times
-------------------------------------------*/
// Edit this part
riBw = '92%'; // Your Board width.
riBn = "Your Forum"; // Your Board's name.
// No need to edit below
var r = Math.floor(Math.random()*3);
var s = Math.floor(Math.random()*3);
var riTd = document.getElementsByTagName('td');
document.write("<br/><table width='"+riBw+"' class='bordercolor' cellspacing='1' cellpadding='0' align='center'><tr><td>");
document.write("<table width='100%' cellspacing='0' cellpadding='3' class='riInfo' align='center'><tr><td align='left'>");
// Begin First Cell
if(pb_username=='Guest'){
document.write("Welcome to "+riBn+" guest.");
}else{
document.write("Welcome back <a href='index.cgi?action=viewprofile'>"+pb_displayname+"</a>.");
}
document.write("</td><td align='center'>");
// Begin Second Cell
// Random Content for All Members
var riRand = new Array();
riRand[0] = "index.cgi?action=members&view=staff'>View Staff Members";
riRand[1] = "index.cgi?action=modifyprofile&user="+pb_username+"'>Modify Profile";
riRand[2] = "index.cgi?action=pmsend'>Write New PM";
document.write("<a href='"+riRand[r]+"</a>");
// Random Content for Admin
if(pb_username=='admin'){
var riAdmin = new Array();
riAdmin[0] = "index.cgi?action=headersfooters'>Modify H/F";
riAdmin[1] = "index.cgi?action=setting'>Board Settings";
riAdmin[2] = "index.cgi?action=pmall'>PM All Members";
document.write(" - <a href='"+riAdmin[s]+"</a>");
}
document.write("</td><td align='right'>");
// Begin third Cell
if(riTd[2].innerHTML.match(/action=pm">(\d+)\s/i)) {
var riTotalPm = RegExp.$1
}
if(riTd[2].innerHTML.match(/, (\d+)\ (are|is) new./i)){
var riNewPm = RegExp.$1
}
if(pb_username=='Guest'){
document.write("Please <a href='index.cgi?action=login'>login</a> or <a href='index.cgi?action=register'>register</a>.");
}else{
document.write("PM Stats: <a href='index.cgi?action=pm'>"+riNewPm+"</a> new out of <a href='index.cgi?action=pm'>"+riTotalPm+"</a> total.");
}
document.write("</td></tr></table></td></tr></table>");
//-->
</script>
Put at the top of your GLOBAL HEADERS to ensure it's right below the welcome table.
CUSTOMIZATION
There are two easy-edit things: The CSS and the variables.
CSS
.riInfo{
background-color:#000066;
height:25px;
}
That's the CSS portion. Change "#000066" to the color you'd like the background to be. If you'd like to use an image as the background, add this under the background-color line:
background-image:url(bground.gif);
JS VARIABLES
// Edit this part
riBw = '92%'; // Your Board width.
riBn = "Your Forum"; // Your Board's name.
riBw is the width of your forum. It's set to the ProBoards standard by default. Most commonly used sizes are 700 and 728.
riBn is your forum's name.