Support Request SupportChange background in viewtopic_body for POST_ID

Support Section
Previous topicNext topic
User avatar

Topic Author
Warr007
Users
Users
Magic user status: Offline
Posts: 5
Joined: Aug 2nd, '22, 21:38
    Windows 10 Chrome

Change background in viewtopic_body for POST_ID

Post by Warr007 »

Your phpBB Version: 3.3.8
Your phpBB Type: Standard phpBB
Extensions installed: Yes
Your knowledge: Basic Knowledge

What have you done before the problem was there?
I tried a lot but the code dont work, all is fine in my opinion but code dont applied, the topic remain in original colours.

What have you already tried to solve the problem?
Yes

Description and Message
Hello

I want to change the brackground color of the forum from specific id *used by POST_ID" in viewtopic_body.
I tried to put this code

Code: Select all

<!-- IF S_TOPIC_ID == 39 --><li class=promotopic"></li><!-- ENDIF -->
at the <li class="row but the color remain in original, nothing change.
The css code for .promotopic is:

Code: Select all

.promotopic {
	background-color: #f8edd2;
	background-image: linear-gradient(to top, rgb(0,0,0,0), rgb(241, 220, 167, 0.8));
}
i want to make like a highlight message (if you know)

Can you tell me a idea what i make wrong?[/i]
User avatar

ssl
Donator
Donator
Magic user status: Offline
Posts: 82
Joined: Aug 19th, '20, 10:54
    Mac OS X Opera

Re: Change background in viewtopic_body for POST_ID

Post by ssl »

Hi
Try this, in viewforum_body.html
Find This may be a partial find and not the whole line

Code: Select all

<li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">
Replace with Replace the preceding lines with the following

Code: Select all

<li class="row topic-{topicrow.TOPIC_ID} <!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">

In your stylesheet.css
Add this

Code: Select all

.row.topic-XXX {
    background-color: #bedce8;
}


And this code for the colour when hovering over the subject:

Code: Select all

.row.topic-XXX:hover {
    background-color: #bedce8;
}
  • XXX is the subject ID
phpBB: 3.3.8 | PHP: 8.1
[Some French translation of extensions]
User avatar

martin
Admin
Admin
Magic user status: Offline
Posts: 4847
Joined: Apr 6th, '14, 14:12
    Linux Chrome

Re: Change background in viewtopic_body for POST_ID

Post by martin »

!important goes along way also :whistl:
Use this to install an ext on your board no more ftp or path making.
Path too install this ext is ext/boardtools/upload
Download is here Make it easy for us to solve your issues
User avatar

Sniper_E
VIP
VIP
Magic user status: Offline
Posts: 1056
Joined: Oct 14th, '14, 17:01
    Android Chrome

Re: Change background in viewtopic_body for POST_ID

Post by Sniper_E »

Good job ssl... Your setup will allow any topic to have a unique background color or border color if you want. Simply add a class for as many topic id you want.

But I recommend you stay away from using !important in your css any time you can. In this case I would recommend putting your topic-{topicrow.TOPIC_ID} at the end of the <li line just after the last <!-- ENDIF -->

[ Posted using my Android device ]
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™
Previous topicNext topic