MyBB Community Forums

Full Version: Apply CSS class or edit template of closed thread listing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Specifically, the listing that appears in the forum main view. Since I got rid of folders and post icons, there's no visual indication of a closed thread, and I'd like to add one. Currently the only one I can think of is creating a "Closed" prefix and using moderator tools, but I'd prefer if I could do a CSS class or template edit.
It's not possible with just template edits and CSS. You could put this in the templates:

class="closed_class_{$thread['closed']}"

(or add closed_class_{$thread['closed']} to an existing class="" attribute) and then make a class called closed_class_1; because $thread['closed'] would be 1 if it's a closed thread, it'd say closed_class_1 when the template is loaded, thus using the class.

Problems with that though; if you put that in the <tr> tag in forumdisplay_thread, it won't show as the trow1/trow2 in the <td> tags will override it. If you put it in the <td> tags, it won't show up either, and if you put !important in the class, it'll show, but things like inline thread moderation won't change the colour of the row.

It should be very easy to do as a small plugin though, would just need to edit the $bgcolor variable to the class for closed threads, if you'd want me to write that up quickly for you.
Home » Template Sets » theme name » Forum Display Templates » forumdisplay_thread

Find:
{$attachment_count}
		<div>

Replace With:
{$attachment_count}
		<div class="{$folder}">

Now to style them in the css use:
.dot_lockfolder {
something:someotherthing;
}

This should work but it is untested.
(2010-09-30, 08:50 PM)MattRogowski Wrote: [ -> ]It should be very easy to do as a small plugin though, would just need to edit the $bgcolor variable to the class for closed threads, if you'd want me to write that up quickly for you.

If it's not too much trouble for you, I'd really appreciate it. Ideally, I'd like all closed threads to have the prefix "Closed" sort of like how all moved threads are prefaced with "Moved".
@Damion That's a similar way of doing it as I suggested but will have the same problem.
(2010-09-30, 08:57 PM)Uncontrol Wrote: [ -> ]
(2010-09-30, 08:50 PM)MattRogowski Wrote: [ -> ]It should be very easy to do as a small plugin though, would just need to edit the $bgcolor variable to the class for closed threads, if you'd want me to write that up quickly for you.

That could be done with a :before in css.

If it's not too much trouble for you, I'd really appreciate it. Ideally, I'd like all closed threads to have the prefix "Closed" sort of like how all moved threads are prefaced with "Moved".

(2010-09-30, 08:58 PM)MattRogowski Wrote: [ -> ]@Damion That's a similar way of doing it as I suggested but will have the same problem.

I thought he wanted to style the text, In which my way would work, But if he did want to style the trow then he would probably need a plugin as you said.
Ah I see, I had in mind he wanted to colour the table row... don't know where I read that.

You're right; make the template edit Damion posted, then add something like this to global.css

.dot_hotlockfolder:before, .dot_lockfolder:before, .dot_newhotlockfolder:before, .dot_newlockfolder:before, .hotlockfolder:before, .lockfolder:before, .newhotlockfolder:before, .newlockfolder:before {
content: "Closed:";
}

Or if you would like to colour the row, I'll write up a plugin for it.
No, I don't want to color the row, though it's a pretty cool idea LOL

So basically you're saying I should re-insert the folder code into the template? But I don't want the folders to appear at all. So how can i make sure that no folders appear, and that "Closed:" appears in front of closed thread subjects?

Sorry, I'm totally clueless at this one. I appreciate all the help.
(2010-09-30, 10:13 PM)Uncontrol Wrote: [ -> ]No, I don't want to color the row, though it's a pretty cool idea LOL

So basically you're saying I should re-insert the folder code into the template? But I don't want the folders to appear at all. So how can i make sure that no folders appear, and that "Closed:" appears in front of closed thread subjects?

Sorry, I'm totally clueless at this one. I appreciate all the help.

If you follow my first post, It will not re-insert the images but give a class of the name of the image, So you can use that to style the closed threads.

And using the code Matt gave in his last post will enable you to have "Closed:" prefix on the closed threads.
haha it worked! thanks!
Pages: 1 2