We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Individual Banners for each forum; By .Scott
Topic Started: Feb 3 2010, 11:31 PM (2,455 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: .Scott
Individual Banners for each forum
 
Name: Individual Banners for each forum
Description: Will allow the use of specific banners for each unique forum.
Copyright: slayer766
Known Bugs: None
Browser compatibility: All
Preview/screen shot: None
Installation: Board Template - Below the board:

Code:
 
<script type="text/javascript">
var Ban_ = new Array();s=0;
Ban_[s++] = [Forum number to display banner in,"Banner Image"];

if(location.href.match(/topic/i)){
$("#nav a:last").each(function(){
for(j in Ban_){
if($(this).attr("href").split("forum/")[1].split("/")[0] == Ban_[j][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[j][1]+"'></a></div>");
}
}
});
}
if(location.href.match(/\/forum\/(\d+)/i)){
for(n in Ban_){
if(RegExp.$1 == Ban_[n][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[n][1]+"'></a></div>");
}
}
}
</script>

To have more banners for different forums just add this line after each other:

Ban_[s++] = [Forum number to display banner in,"Banner Image"]
Offline Profile Quote Post Goto Top
 
zettaiyo
Member
[ * ]
I tried this code on my board and it didn't work.

Quote:
 
<script type="text/javascript">
var Ban_ = new Array();s=0;
Ban_[s++] = [Forum number to display banner in,"Banner Image"];

if(location.href.match(/topic/i)){
$("#nav a:last").each(function(){
for(j in Ban_){
if($(this).attr("href").split("forum/")[1].split("/")[0] == Ban_[j][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[j][1]+"'></a></div>");
}
}
});
}
if(location.href.match(/\/forum\/(\d+)/i)){
for(n in Ban_){
if(RegExp.$1 == Ban_[n][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[n][1]+"'></a></div>");
}


Are the colored parts where I need to change for my forum specifically? Also I tried the code that was requested a few days ago and it didn't work on my board either. http://resources.zetaboards.com/topic/5079672/1/#new

Any help would be appreciated.


Offline Profile Quote Post Goto Top
 
viperver1
Member
[ * ]
Nope you can only edit the first part of the code. Just look where Ban_[s++] = [Forum number to display banner in,"Banner Image"] is and edit that line. You can add a different line by adding it underneath so in short, look here I've made the changes you need to do in green and red (green for forum number and red for the image url:
Quote:
 
<script type="text/javascript">
var Ban_ = new Array();s=0;
Ban_[s++] = [Forum number,"http://Banner_Image"];

if(location.href.match(/topic/i)){
$("#nav a:last").each(function(){
for(j in Ban_){
if($(this).attr("href").split("forum/")[1].split("/")[0] == Ban_[j][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[j][1]+"'></a></div>");
}
}
});
}
if(location.href.match(/\/forum\/(\d+)/i)){
for(n in Ban_){
if(RegExp.$1 == Ban_[n][0]){
$("#logo").html("<div align='center'><a href='"+main_url+"'><img src='"+Ban_[n][1]+"'></a></div>");
}
}
}
</script>

If you want another forum to have a different banner, then just the same line under the edited line. However it's not my thing to make people try different variations to try making it work but I can make it simpler to edit.
Offline Profile Quote Post Goto Top
 
zettaiyo
Member
[ * ]
Thank you so much!
Offline Profile Quote Post Goto Top
 
fixifiq
Member
[ * ]
Ban_[s++] = [Forum number to display banner in,"Banner Image"];


what should i write in "forum number to display banner in"? Is it my forum name?
Offline Profile Quote Post Goto Top
 
Pando
Member Avatar
Member
[ *  *  *  *  *  * ]
fixifiq
Feb 16 2011, 01:39 AM
Ban_[s++] = [Forum number to display banner in,"Banner Image"];


what should i write in "forum number to display banner in"? Is it my forum name?
For example, the forum number for codes and modifications is 1000323. Clicking on the URL of the forum gives you http://resources.zetaboards.com/forum/1000323/, the forum number is that number at the end of the URL.
Offline Profile Quote Post Goto Top
 
fixifiq
Member
[ * ]
thank you!
Offline Profile Quote Post Goto Top
 
tobeme
Member Avatar
Member
[ *  * ]
Can I use this code for the index page as well, which doesn't have the forum number?
I have just realized that I must have a banner for the index page, which is set up in the theme setting. For the rest of the forum pages, I can use the above codes.

However, the problem with this setup is that everytime when a page is loaded, the index page banner will loaded first. After a flash, the rspective forum pages are loaded.

Is it possible to set up the banner for the index page in this way as well so that the banners don't have to load twice?

Thanks. :)
Edited by tobeme, Jul 25 2012, 03:13 AM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
For anyone else that has tobeme's issue, check out this post: http://resources.zetaboards.com/topic/5153468/findpost/8315604/

It essentially does the same thing as this code, but it's much shorter.
Online Profile Quote Post Goto Top
 
0 users reading this topic
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply