vForums Support > Programming & Coding :: Code Requests & Support :: > Different new/old images for certain boards
Different new/old images for certain boards - Posted By Aiken (ionfortuna) on 13th Dec 09 at 7:28pm
Would it be possible to have a code to change the new/old images for specific boards, this will be used for like guild boards on my forum where the new/old images are the icon/logo for their guild
The code must work for sub-boards, I saw a code similar to this but it wouldn't work for the sub-board, when I tried it changed for the board that the sub-board was in
Example:
My guild on my forum is called Crimson Lotus with these images:
Title:
for the group image
New:
Old:
Re: Different new/old images for certain boards - Posted By Aiken (ionfortuna) on 15th Dec 09 at 9:57pm
A reply would really help
Re: Different new/old images for certain boards - Posted By Ross (admin) on 15th Dec 09 at 11:51pm
Hi,
I will reply to this in the morning. There's a couple of ways it could be done and I'd like to check which is the most efficient.
Re: Different new/old images for certain boards - Posted By Ross (admin) on 16th Dec 09 at 10:00am
Hi,
I think this is the most efficient way of achieving that.
Firstly, in your global header, enter this piece of code. Repeat the lines in red as many times as necessary, entering the board id and images urls where indicated:
<script type="text/javascript">
<!--
var unread_board_images = new Array();
unread_board_images["general"] = new Array("Read Image URL", "Unread Image URL");
unread_board_images["board-id"] = new Array("Another Read Image URL", "Another Unread Image URL");
function unread_board_image(board_id, has_new_posts, default_image) {
if("undefined" != typeof unread_board_images[board_id]) {
if(has_new_posts) {
document.write('<img src="'+ unread_board_images[board_id][1] +'" alt="New Posts" />');
} else {
document.write('<img src="'+ unread_board_images[board_id][0] + '" alt="No New Posts" />');
}
} else {
document.write(default_image);
}
}
//-->
</script>
And then, in your board template (Admin -> Manage Templates -> Board Listing), enter this where the new posts image should appear. There's no need to change any parts of it.
<script type="text/javascript"> unread_board_image('{board_id}', {has_new_posts}, '{new_posts}'); </script>
Re: Different new/old images for certain boards - Posted By Aiken (ionfortuna) on 16th Dec 09 at 1:43pm
Great, I think this should be in the database so other people can use it