Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: SilentNoise on September 29, 2004, 05:45:15 PM

Title: How to: Bold text for stuck topics?
Post by: SilentNoise on September 29, 2004, 05:45:15 PM
Right now the only way to tell the difference between the stuck topics and the regular ones is to look at the little icon beside topic, and IMO, that little graphic isn't THAT telling, so it doesn't really let you know that those items are sticky topics.

Anyway, what I'm asking is, is there a way to make the sticky topics appear in bold text, just to seperate them from the regular topics?
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on September 29, 2004, 06:08:28 PM
Themes/yourtheme/MessageIndex.template.php:

Find:
', $topic['first_post']['link'];

Replace:
<span', $topic['is_sticky'] ? ' style="font-weight: bold;"' : '', '>', $topic['first_post']['link'], '</span>';

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: SilentNoise on September 30, 2004, 05:55:44 PM
Awesome stuff.

Thanks again
Title: Re: How to: Bold text for stuck topics?
Post by: LostProphecy on October 08, 2004, 05:47:55 AM
while we are on this??

what would be the modification to also make locked topics say.... in italics...

and also would that then mean that a locked sticky topic would be bold and in italics??
Title: Re: How to: Bold text for stuck topics?
Post by: Prone on October 08, 2004, 05:57:02 AM
Perfect!

Thx [Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 08, 2004, 04:15:35 PM
Quote from: LostProphecy on October 08, 2004, 05:47:55 AM
while we are on this??

what would be the modification to also make locked topics say.... in italics...

and also would that then mean that a locked sticky topic would be bold and in italics??

You could do that... just use 'is_locked'.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: LostProphecy on October 10, 2004, 04:23:34 AM
sooo... if i put this would it be right?

<span', $topic['is_sticky'] ? ' style="font-weight: bold;"' : '', $topic['is_locked'] ? ' style="font-weight: italics;"' : '', '>', $topic['first_post']['link'], '</span>';
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 10, 2004, 04:47:27 PM
<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-weight: italics;' : '', '">', $topic['first_post']['link'], '</span>';

Try that.
Title: Re: How to: Bold text for stuck topics?
Post by: CapriSkye on October 15, 2004, 08:28:25 PM
italic isn't working for my locked sticky topic for some reason.
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 15, 2004, 09:32:14 PM
Quote from: [Unknown] on October 10, 2004, 04:47:27 PM
<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-weight: italics;' : '', '">', $topic['first_post']['link'], '</span>';

Try that.

Wait a minute there.  Font weight... italics?  I just cleaned it up.  Let's try this:

<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '">', $topic['first_post']['link'], '</span>';

How about that?

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: CapriSkye on October 15, 2004, 09:37:37 PM
works great! thank you
Title: Re: How to: Bold text for stuck topics?
Post by: Lum-chan on October 26, 2004, 02:43:15 PM
Wich file would be edited then? The bold sticky did work quite well here, but locked topic isn't quite clear to me.

Any directions for a n00bie on SMF 1.0 RC1 ?

Thanks in advance
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 26, 2004, 06:51:34 PM
Quote from: Lum-chan on October 26, 2004, 02:43:15 PM
Wich file would be edited then? The bold sticky did work quite well here, but locked topic isn't quite clear to me.

Any directions for a n00bie on SMF 1.0 RC1?

Same file, the MessageIndex template.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: Lum-chan on October 27, 2004, 03:18:28 PM
@[Unknown]: Thanks you very much. It works now  (https://www.simplemachines.org/community/Themes/default/images/post/thumbup.gif)
Title: Re: How to: Bold text for stuck topics?
Post by: Jerry on October 28, 2004, 08:22:46 PM
This is gr8 :D thanks onknown. my members just pointed out having a problem telling the difference between lock/pinned topics. Thank you :)
Title: Re: How to: Bold text for stuck topics?
Post by: Waste on October 28, 2004, 11:45:30 PM
Woudl this be right to add "Sticky:" in front of all Sticky topics?:

<span', $topic['is_sticky'] ? ' style="font-weight: bold;"' : '', '>Sticky:', $topic['first_post']['link'], '</span>';
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 28, 2004, 11:48:53 PM
Quote from: Waste on October 28, 2004, 11:45:30 PM
Would this be right to add "Sticky:" in front of all Sticky topics?:

Not quite...

<span', $topic['is_sticky'] ? ' style="font-weight: bold;">Sticky: ' : '>', $topic['first_post']['link'], '</span>';

Should do it.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: Waste on October 29, 2004, 12:06:34 AM
As always, thanks for the help [Unknown].
Title: Re: How to: Bold text for stuck topics?
Post by: CapriSkye on October 29, 2004, 12:55:52 AM
i've been trying to add text string $txt['modlog_ac_stickied'] but with no luck, it's just too confusing :(

this is what i have for the sticky topic:

<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '">', '<span title="', $topic['first_post']['preview'], '">', $topic['first_post']['link'], '</span>', '</span>';


please help, thanks
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 29, 2004, 02:10:25 AM
Well, modlog_ac_stickied is only defined in the admin center and mod log, etc.  It's not defined when viewing a topic, because it's not needed.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: moaltmann on October 29, 2004, 12:02:25 PM
okay, I know you've been waiting for this combination ;-)

If you want:

and you want this to work for locked and sticky topics then my solution is nesting <span> statements but that's ugly, i.e.

find

', $topic['first_post']['link'];

and replace with (for redability i broke the lines)

                        <span style="
                            ',  $topic['is_sticky'] ? 'font-weight: bold;">Sticky: ' : '">', '
                                <span style="
                                    ', $topic['is_locked'] ? 'font-style: italic;">Locked: ' : '">' ,'
                                    ', $topic['first_post']['link'], '
                                </span>
                        </span>';


can someone make this elegant?

btw, if I were to want to want the test after the topic name I will have to either have two "  ', $topic['first_post']['link'], ' or another set of if-then (', $topic['is_sticky'] ? and so on ).

thanks,
  Mischa
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 29, 2004, 04:19:30 PM
                        <span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '">
                                ', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked' : ''), ' ', $topic['first_post']['link'], '
                        </span>';


Perhaps?  This is slightly different - a locked sticky will only show "Sticky:", but will be bold and italic.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: moaltmann on October 29, 2004, 05:33:20 PM
hm, interesting idea.

though performance is of no real importance for me I wonder whether testing for property of topic four times (instead of twice) will have any impact. In my solution I was trying to get away with only one test per property.

I honestly don't know whether it has any impact on a "huge board". (Are such queries cached?) If it does I'd rather go with the nested <span>.

thanks,
  mischa
Title: Re: How to: Bold text for stuck topics?
Post by: [Unknown] on October 29, 2004, 06:46:41 PM
Well, it's just a variable.  It wouldn't hardly have that much impact, if you wanted it to be as fast as possible, you'd use an if structure instead of several nested ternaries.

But, once it's compiled it wouldn't matter anyway, so if you have a PHP accelerator/optimizer/cache... it won't really matter, no.  Nor would it depend on the size of the forum, because it would only do it once per every *displayed* topic anyway; which is going to be 20 on large forums and 20 on itty-bitty ones.

-[Unknown]
Title: Re: How to: Bold text for stuck topics?
Post by: wba_4_eva on July 04, 2005, 06:45:05 AM
Quote from: [Unknown] on September 29, 2004, 06:08:28 PM
Themes/yourtheme/MessageIndex.template.php:

Find:
', $topic['first_post']['link'];

Replace:
<span', $topic['is_sticky'] ? ' style="font-weight: bold;"' : '', '>', $topic['first_post']['link'], '</span>';

-[Unknown]

When we tried to go on the forums we got a parse error.

Does anyone know how to solve this problem?

Peace out, Andy.
Title: Re: How to: Bold text for stuck topics?
Post by: barnjo on September 11, 2005, 06:19:21 PM
Hi there, dunno how todo this now im on SMF 1.1 beta 3 and the source code has changed.

Anyone help please.
Title: Re: How to: Bold text for stuck topics?
Post by: ApocryphA on February 14, 2007, 11:17:14 AM
I recently upgraded to 1.1.2 and this doesn't work, giving me parse error.  Any update on this would be greatly appreciated. Mainly, bold for stickied topics and italic for locked topics.

Thanks in advance.
Title: Re: How to: Bold text for stuck topics?
Post by: KGIII on June 12, 2007, 09:10:34 PM
In reference to the above question, the code may be a bit dis-similar but you should be able to find what you are looking for if you follow the general idea of what is being done.
Title: Re: How to: Bold text for stuck topics?
Post by: ApocryphA on June 13, 2007, 10:14:11 AM
Yes, thank you.  I've figured out the code a few minutes after my last post :).  Otherwise I wouldn't have stopped posting :D.  Thanks anyway.
Title: Re: How to: Bold text for stuck topics?
Post by: Assistance on June 19, 2007, 07:54:31 AM
I'm actually surprised no one has made a topic multi moderation mod like IPB has.
Title: Re: How to: Bold text for stuck topics?
Post by: codenaught on June 21, 2007, 07:22:58 PM
Quote from: Assistance on June 19, 2007, 07:54:31 AM
I'm actually surprised no one has made a topic multi moderation mod like IPB has.
Not exactly sure how this has to do with this topic? But I wrote a mod for topic multi-moderation awhile ago but just haven't gotten it released. I guess it needs to be polished a little more but then I can release a beta version for testing.
Title: Re: How to: Bold text for stuck topics?
Post by: KERA on June 22, 2007, 03:35:05 PM
in SMF 1.1.2 i cant find that code in message index template!
Title: Re: How to: Bold text for stuck topics?
Post by: sup_iran on June 24, 2007, 07:58:02 AM
hi
I dont have ', $topic['first_post']['link']; in this page ! what can I do that?
I can seperate the sticky topics bot I cant bold them.
Title: Re: How to: Bold text for stuck topics?
Post by: djrem on October 04, 2008, 01:09:29 AM
Bump please

"You'll work it out" doesnt really suffice for the braindead among us.

Theres more than one instance of similar "Search for this bit" terms.
Title: Re: How to: Bold text for stuck topics?
Post by: Nathaniel on November 05, 2008, 05:12:40 AM
The edits below are updated for SMF 1.1.6 and above. :)

For the default theme '/Themes/default/MessageIndex.template.php':
Find this code:
            echo '
                            ', $topic['is_sticky'] ? '<b>' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</b>' : '';

Replace with this code:
            echo '
                            ', $topic['is_locked'] ? '<i>' : '', $topic['is_sticky'] ? '<b>' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '</b>' : '', $topic['is_locked'] ? '</i>' : '';


For custom themes '/Themes/default/MessageIndex.template.php':
Find this code:
', $topic['first_post']['link'], '
Replace with this code:
', $topic['is_locked'] ? '<i>' : '', $topic['is_sticky'] ? '<b>' : '' , $topic['first_post']['link'], $topic['is_sticky'] ? '</b>' : '', $topic['is_locked'] ? '</i>' : '