Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Forums - Different Image backgrounds?
Corganno (New Admin) 6/5/2011 2:25 PM EST : Forums - Different Image backgrounds?
Corganno
Posts: 584
Zomgawsh Poster

This might end up being more work than it's actually worth, but I was wondering if there was any way to have a different background image for the forums depending on which forum category you were in. 

For example;

-If you're in the main forum overview, you'd see the generic widget background. 
-If you click on the "Class A" forum section, the background inside would be something specific that is related to that class.
-If you click on the "Class B" forum section, etc. 
-Etc...

Unfortunately my coding knowledge is still somewhat low. Can it even be done? Any help would be much appreciated. 
TopBottom

shadowstts (Guild Admin) 6/6/2011 12:51 AM EST : RE: Forums - Different Image backgrounds?
shadowstts
Posts: 364
Fingers of Fury!

id also like this! *reaches for the horn!* *blows the horn!* "is any mottie out there!"

Asylum RULES!

TopBottom

Mottie (MVP) 6/6/2011 9:21 AM EST : RE: Forums - Different Image backgrounds?
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

shadowstts said:
*blows the horn!* "is any mottie out there!"


*genuflect* I heard your beckoning call my lord... where is it you wish this background image to be inside? The overall widget or inside each post?
TopBottom

shadowstts (Guild Admin) 6/6/2011 3:42 PM EST : RE: Forums - Different Image backgrounds?
shadowstts
Posts: 364
Fingers of Fury!

well one id like is more for the proper background each forum has diff one so for example i have a warlock forum were any warlock and post a topic and discuss it that forum has background of warlock related (altho corganno should go first it was his topic after all)

Asylum RULES!

TopBottom

Mottie (MVP) 6/6/2011 5:51 PM EST : RE: Forums - Different Image backgrounds?
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Ok, try this:

Topic Specific Background Image in the Forums

I haven't throughly tested this script, but it should work *crosses fingers*. Basically if the script exactly matches the forum topic name it will add a predefined background image. Add the following script to a hidden Free Form Text/HTML widget (ideally), Footer HTML or into the custom javascript/jQuery area.

The only reason I used Warhammer in the code below is because it was the only game with huge icons that I had saved in my photobucket 

Topic List ( Forums : Warhammer > Dwarf )
Topic ( Forums : Dark Elf > Dark Elf Play Guide )

Code
<style>
.gpWidget-forumslrg .ContentBoxBody,
.gpWidget-forumslrg .PostItem1 { background:
transparent no-repeat top right; }
</style>
<script>
$(function(){
 if ($('.gpWidget-forumslrg').length){
  var changeSiteBackground = false,
  backgrounds = {

   '
Dwarf'     : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/Dwarf.png',
   '
Empire'    : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/Empire.png',
   '
High Elf'  : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/HighElf.png',
   '
Greenskin' : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/Greenskin.png',
   '
Chaos'     : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/Chaos.png',
   '
Dark Elf'  : 'http://i201.photobucket.com/albums/aa236/Mottie1/testsite/icons/DarkElf.png'
  }

  // ***************************
  // Don't change anything below
  // ***************************

  ,nm, topic = window.location.search.match('TopicID='), ct = $('.ui-crumbtrail-wrapper');
  if (ct.length){
   nm = $('.ui-crumbtrail-wrapper').text();
   nm = $.trim( (topic) ?
    nm.substring(nm.indexOf(':') + 1, nm.indexOf('>')) : // inside a topic, look for parent
    nm.substring(nm.indexOf('>') + 1, nm.length) ); // on topic list page
   if (backgrounds.hasOwnProperty(nm)) {
    ct = (changeSiteBackground) ? $('body') : $('.gpWidget-forumslrg').find('.ContentBoxBody');
    ct.css('background-image', 'url(' + backgrounds[nm] + ')');
   }
  }
 }
});
</script>
Customizing
  • Background image location:

    • Set changeSiteBackground to true to change the overall site background image, or false to only change the forum widget background image.

  • The CSS at the top of the code is needed:

    • To clear the background, hopefully it isn't a problem since the background image/color is usually added to the widget and not the Content Box. But if it causes you any trouble or if you can't see the new background image, please post a message here and I'll take a look at the problem.
    • It also positions (the "top right" in red) the background image. Change this to move the background image to where ever you want it.
    • If you have an repeating background image then remove the "no-repeat".

  • The backgrounds variable is set up as follows.

    • Each entry is referred to as a key:value pair. For instance, in the code "Dwarf" would be the key (in blue) and the url of the image is the value (orange).
    • Each line, except the last, should end with a comma. If you accidentally add a comma to the last line, IE will break.
    • The key (blue) must exactly match the sub-forum name "Dwarf" in the first screenshot and "Dark Elf" in the second screenshot.
    • The value (orange) must be a url that points to an image. To adjust the position of the image, use the css - see the list above.
Edit (6/6/2011): Added a variable to change the site background.
Edit (6/8/2011): Updated script.
TopBottom

shadowstts (Guild Admin) 6/6/2011 6:53 PM EST : RE: Forums - Different Image backgrounds?
shadowstts
Posts: 364
Fingers of Fury!

it works, any chance of one for changing the background image not the widget background?

Asylum RULES!

TopBottom

Mottie (MVP) 6/6/2011 7:02 PM EST : RE: Forums - Different Image backgrounds?
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Can you be more specific? I can't see your forums page (not publicly available) so, on your site, do you mean the off-white colored background?
TopBottom

shadowstts (Guild Admin) 6/7/2011 6:41 AM EST : RE: Forums - Different Image backgrounds?
shadowstts
Posts: 364
Fingers of Fury!

the background the one like on guildportal the purple to black gradiant background 

Asylum RULES!

TopBottom

Mottie (MVP) 6/7/2011 10:41 AM EST : RE: Forums - Different Image backgrounds?
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Ok, I've updated the code to include a "changeSiteBackground" variable. Just replace your code and change that variable to true.
TopBottom

shadowstts (Guild Admin) 6/8/2011 1:06 AM EST : RE: Forums - Different Image backgrounds?
shadowstts
Posts: 364
Fingers of Fury!

i was thinking more of a seprate script for it so you dnt have to have both less u want to 

Asylum RULES!

TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%