Welcome Guest [Log In] [Register]

Welcome to Big Boards. Big Boards at one time offered the Zathyus network our long famous Resource Archives, our extensive search indexes, and our info-packed resource forums. Eventually, these were made redundant by upgrades to the documentations and expanded search features added to the ZetaBoards software, and this forum then lost relevancy and subsequently became inactive.

Our team then embarked on a new project called Planet Nexus, where a bold new experiment in forum promotion is taking place. We call it nexworking. NexusTree offers social networking pages for forums in a fully automated format. Your NexusTree page is created instantly when your join the nexus. Find out more by visiting Planet Nexus, and become part of the nexworking revolution.

Posted Image Posted Image
If you're already a member please log in to your account for additional access:

Username:   Password:
Closed Topic
Conditional Statments, if then else; Possible?
Topic Started: Aug 25 2006, 03:12 AM (448 Views)
Gabby Hayes
Member Avatar
BB Alpha
[ * ]
Wondering if it is possible to use some sort of conditional statements (IF THEN ELSE)?

As a rough example:

IF member = one group THEN GOTO this forum, or IF member = another group THEN GOTO this forum, ELSE GOTO this default forum.

Is there any option for conditional statements anywhere within the board?

This feature could make forums very configurable.

Seems IF THEN ELSE statements are universal (in just about every programming or coding language) would imagine there is something here which is similar.

Thanks in advance.
Beta Testers, Technicians needed.

Setting up complex board, any and all help, suggestions, visitors encouraged to leave any and all comments, good or bad.

Tyrell Corporation

Thanks.
Offline
Profile
Goto Top
 
HelenaZF
Member Avatar
advanced techno-feeb

Well, I know that you can use conditional statements in javascript coding. Conditional statements are one way to do things in javascript, like in this script:
Code:
 
<script type="text/javascript">
if(window.XMLHttpRequest)xmlhttp_type="Standard";
else if(window.ActiveXObject)xmlhttp_type="ActiveX";
else if(window.createRequest)xmlhttp_type="IceBrowser";
else xmlhttp_type="Unknown";
alert(xmlhttp_type);
</script>


The same thing can be done with switch and type statements.


different applications of how to do the same thing as in the code above are in this thread in the javascript discussion board:
http://www.webdeveloper.com/forum/showthre...4818#post624818

There is a lot of coding help available on these forums:
http://www.htmlgoodies.com
If you are looking to learn about coding, it might be worth registering on the discussion boards there. There is a very lively javascript forum. I use the HTML forum a lot too.

As for whether you can use them somehow in the actual board controls, I really have no idea, but maybe someone else will know what is possible. (Hopefully, I haven't totally missed the intent of your question. :) )
Posted Image Visit the Planet Nexus page!Posted Image

Posted Image
Download some of my graphic sets HERE
Offline
Profile
Goto Top
 
slaytanist
Cool IF Coder
[ *  *  * ]
You could make your link a JS function.

Code:
 
<a href="Javascript:SwitchForum();">Click Here</a>


You can set the href of an existing link in Javascript like so:

Code:
 
a=document.links;
for (i=0;i<a.length;i++)
if (a[i].href=="LINK TO CHANGE")
a[i].href="Javascript:SwitchForum();";


With that out of the way:

Code:
 
function SwitchForum()
{
memclass="guest";
memlink=document.getElementById("userlinks").getElementsByTagName("A")[0].href;
a=document.getElementsByTagName("DIV");
for (i=0;i<a.length;i++)
if (a[i].className=="thin")
{
b=a[i].getElementsByTagName("A");
for (j=0;j<b.length;j++)
if (b[j].href==memlink)
memclass=b[j].getElementsByTagName("SPAN")[0].className;
}

if (memclass=="guest")
window.location="URL to send guests"
else if (memclass=="admin")
window.location="URL to send admins"
else if (memclass=="coder")
window.location="URL to send coding staff"
else if (etc...)
}


You could also happily use a switch statement as Helena said but I'm not aware of them being much if at all faster in Javascript...

You will have to set up CSS classes in your member suffixes/prefixes for that to work, eg. <span class='admin'> </span> and in your CSS: .admin {color:red} (preferable to do it that way anyway, since it will work with skin selectors ; ) ) It will also only work on the index page. For any other page you will need iframes, AJAX, or storing the info in a cookie. If you need it to work on another page please ask.

Finally this is not useful for hiding pages from membergroups, since anyone can just view the source and take the URLs. I can think of a couple of ways of doing it, one using PHP and one using PMs and cookies. Again if you require this just ask.

Cheers.
Posted Image
Click here!
Offline
Profile
Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Global Support Archive · Next Topic »
Closed Topic