YAFLogo

captainspud
  • captainspud
  • 52% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
YAF comes with five default Topic Statuses, each with an associated 16px square icon. On my forum I'd like to use custom icons for the statuses that aren't square, but the forums automatically add this attribute inline to the IMG tag:

This squishes my icons (which are 50px wide) into a square shape, making them illegible. I first tried to change this in CSS:

.yafnet tr.topicRow a.post_link img {

border: 1px #f06 solid;

width: 50px;

}

However, inline styling overrides class styling, so the explicitly-defined border and width aren't affected by my code. I then tried to find the spot in the source files where topic listings are generated, but this wasn't very helpful either. I thought I found what I was looking for in TopicLine.ascx, line 44-47:

However, while this code block clearly writes the tag wrapped around the title text, it never explicitly writes out the tag. I'm guessing the Status image is being added by the FormatTopicName() function, but I haven't been able to figure out where YAF stores its function definitions, so my search has more or less hit a brick wall.

So, in a nutshell:

1. Is there an easier, more direct way to change how YAF writes out the IMG tag for the Topic Status so that the style="" attribute can be edited or, ideally, removed entirely (since I'd ideally like to use different-sized icons)?

2. If not, where in the YAF files can I edit FormatTopicName()?

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
11 years ago
Yes it is currently hard coded inline styling (Very lazy coding).

I changed it (in change set 1559ef03df2f ) to an css class and now it can be controlled from the forum.css and overridden by the theme.css

If you are not able to make the changes to the source code and compile yaf you can use the !important attribute to change the width

.yafnet tr.topicRow a.post_link img {

border: 1px #f06 solid;

width: 50px!important;

}

captainspud
  • captainspud
  • 52% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
Thanks, I forgot I could use !important to force a CSS attribute to be used. :)

It still displays wrong on the forum index because the Status icons there aren't wrapped in any specially-classed tags I can reference, but I can live with that for now; the important thing for us was to have them display at the correct size within their actual forum.