MyBB Community Forums

Full Version: Guest Message javascript problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have found a guest message javascript. But when i add the script in the "header_welcomeblock_guest" template the message shows in every page of my forum including registration form page & terms and condition page.

But I don't want the message to be shown in the registration form page & terms and condition page. I just want the code to be shown to the guests to every page of the forum other than above mentioned 2 pages.

If there any possible way i can do that. Please help me in this matter, I am clueless.

I am providing the script as well as the message screenshot below.

Message Script:

<!-- MTR OYNAK REKLAM KODU eAGLe -->
<style type="text/css">

#reklam01{
position:absolute;
border-left: 5px solid #FF0033;
border-right: 5px solid #FF0033;
border-top: 5px solid #FF0033;
border-bottom: 5px solid #FF0033;
padding: 8px;
background-color: #ffffff;
width: 600px;
visibility: hidden;
z-index: 400;
}

</style>

<script type="text/javascript">
var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 180 //set x offset of bar in pixels
var startY = 300 //set y offset of bar in pixels
var verticalpos="frombottom" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("reklam01").style.visibility="hidden"
}

function staticbar(){
barheight=document.getElementById("reklam01").offsetHeight
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
var d = document;
function ml(id){
var el=d.getElementById(id);
if (!persistclose || persistclose && get_cookie("remainclosed")=="")
el.style.visibility="visible"
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function(){
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : iecompattest().scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/5;
}
else{
var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
ftlObj.y += (pY - startY - ftlObj.y)/5;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 8);
}
ftlObj = ml("reklam01");
stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
</script>
<div id="reklam01">
<div align="center">

<b><a href="http://www.forum.tech2game.com/member.php?action=register">Register</a> to get rid of this annoying message. If already a member, Please <a href="http://www.forum.tech2game.com/member.php?action=login">Login</a>.</b>

<br /><a href="http://www.forum.tech2game.com/member.php?action=register" target="_blank" onClick= closebar(); return false";
<font size="1"><img src="http://i33.tinypic.com/sfj58o.png" border="0" alt="Close and Register"></font></a></a>
</div>
</td>
</div>
<!-- MTR OYNAK REKLAM KODU eAGLe -->

Message Screenshot:

[Image: xf70gn.png]

My forum link:

http://www.forum.tech2game.com
You will have to add to every page in the templates such as top of index page, top of forum display, top of thread display.
But I just want that only guest can see it. But if I add this script in index forum display etc etc then it will be shown to all, And I don't need that because its a guest message. Undecided
Why not use an exisiting plugin such as:

http://mods.mybboard.net/view/guests-reg...ion-invite