different background on each forum?

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

different background on each forum?

Post by AlexMG »

Hi there!
Is there any way to add a different background image to a specific forum?
Let's say we have Counter Strike Forum with subforums and description. I just to have a background image there to cover all the section. And just on index page.
User avatar
janus_zonstraal
Registered User
Posts: 5038
Joined: Sat Aug 30, 2014 1:30 pm

Re: different background on each forum?

Post by janus_zonstraal »

Make different styles with different backgrounds and give the forum the style you want.
Sorry! My English is bat ;) !!!
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

I mean the viewforum not the forum.
User avatar
janus_zonstraal
Registered User
Posts: 5038
Joined: Sat Aug 30, 2014 1:30 pm

Re: different background on each forum?

Post by janus_zonstraal »

What do you mean, the board or a forum?
You can give every forum a other style in ACP=> forum
Sorry! My English is bat ;) !!!
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

Sorry i'm not so clear.

Image

And this mod: https://www.phpbb.com/customise/db/mod/ ... or_phpbb3/

I hope you understand now. Thank you!
User avatar
ssl
Registered User
Posts: 463
Joined: Sat Feb 08, 2020 2:15 pm
Location: France
Name: Fred
Contact:

Re: different background on each forum?

Post by ssl »

Hi
You talk about something like that?

Capture d’écran 2021-01-11 à 00.41.25.png
Sorry for my English ... I do my best!
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

Hi!
Something like that. But i want the image to be completely visible. behind the forums.
User avatar
Lumpy Burgertushie
Registered User
Posts: 68474
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: different background on each forum?

Post by Lumpy Burgertushie »

yes it is possible but you would have to add a lot of code to the css and the html of the style.

it would need a line of code for each forum that you have.

for instance, something similar to :

If forum id = 4 background image = whatever.jpg
If forum id = 5 background image = something else.jpg
etc. etc.

then you would have to redo all those edits each time you update/upgrade your style.

not to mention if you have more than one style you would probably want to do it to each style.
robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Gumboots
Registered User
Posts: 410
Joined: Fri Oct 11, 2019 1:59 am

Re: different background on each forum?

Post by Gumboots »

You can do it without HTML edits if you install the Collapsible Categories extension. That extension should hardly ever need updating, and includes its own CSS file. This makes it a good candidate for adding custom CSS because you won't have to re-do the edits very often (if at all).

The extension adds an anchor before each category, and the anchor has the category number as part of its ID attribute. Example:

Code: Select all

<a class="category" id="category11" style="display: none; height: 0"></a>
This allows you to target the background of each category by using an adjacent selector:

Code: Select all

#category11 + .forabg {background: url(whatever.jpg)}
#category22 + .forabg {background: url(another.jpg)}
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

Thank you but dosen't work. Can u check it out for me please? http://veridic.ro/phpBB3/index.php

I added the css in common.css and colours.css .
User avatar
Gumboots
Registered User
Posts: 410
Joined: Fri Oct 11, 2019 1:59 am

Re: different background on each forum?

Post by Gumboots »

Well you showed a screenshot of a style closely based on Prosilver, but the style on your site has completely different markup. You also don't have the extension installed, so obviously the code I suggested wouldn't work even with Prosilver due to the lack of the relevant anchors. So remove that code.

As it turns out, the style shown on your link already has the category id number built in to the markup, which means you can skip the extension. Current CSS is:

Code: Select all

.forabg {
    background: transparent none repeat-x 0 0;
}
Which is pretty stupid since there's no need to define most of that crap. Not that it matters for what you want to do. You can just use this:

Code: Select all

#forum-1 {background: url(whatever.jpg)}
#forum-5 {background: url(another.jpg)}
That should do if you want to use a small image that tiles. If you want to use a large image that doesn't tile I'd add:

Code: Select all

.forabg {
    background-size: cover;
}
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

It works perfect with category because of the colapse extension. I use this code and it works.

Code: Select all

#category-1 {
background-color: lightblue;
}
Thank you so much for this! But it is posible to add ca specific colour or image just to a forum? I think i need a unique ID for the forum and a div class.
User avatar
Mannix_
Registered User
Posts: 1014
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt
Contact:

Re: different background on each forum?

Post by Mannix_ »

Like this ?
Veridic.ro - Index page veridic.ro 573bef314665.png
you would need something like this

Code: Select all

#category-1 .forums li.row:nth-child(1) dl {background-image: url(https://img.esportnow.pl/BMfdzYiZzxEWlTwKuazwAqAS1zc=/768x0/smart/https://esportnow.pl/wp-content/uploads/2017/07/20_198712968.jpg);}


#category-1 .forums li.row:nth-child(2) dl {background-image: url(http://veridic.ro/phpBB3/styles/pbwow3_heroes/theme/images/global-bg2.jpg);background-size: cover;}

#category-1 .forums li.row:nth-child(3) dl {background-image: url(https://img6.gram.pl/sfwr20190920202247129jzsj.jpg);background-size: cover;}

.forums li.row dl {
    background-size: cover;
}
But remember you can't change the order of the forums in ACP afterwards
-=-=-=-=-=-=-=-=-=-=-=-=-My Styles-=-=-=-=-=-=-=-=-=-=-=-=-
HexagonHexagonRebornCleanSilverProject Durango
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Need help with styling or want me to port a style to 3.3.x etc. contact me here or here.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
AlexMG
Registered User
Posts: 9
Joined: Wed Feb 10, 2016 10:24 am

Re: different background on each forum?

Post by AlexMG »

Thank you sir !!!
Post Reply

Return to “phpBB Custom Coding”