Changing the "postingbuttons" font

Started by James Gryphon, November 15, 2016, 05:36:47 PM

Previous topic - Next topic

James Gryphon

The SMF version is 2.0.12; I'm using an extensively modified Core variant.

For reasons I won't go into in-depth here, I've been trying to change the font used for the text next to the Quote, etc. icons in the top right to use regular text, rather than bold. I've looked all over the code and can't figure out for the life of me what controls it. I can seem to change most everything else locally, but the fates forbid it use anything but bold text for those boxes.

After spending close to a day messing around with little nagging glitches like this, my patience is waning, so I thought I'd drop a word by here to see if anybody else knows anything about this particular code.

Illori

sources/Subs.php

    return '<img src="' . $settings['images_url'] . '/buttons/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />' . ($label != '' ? '<strong>' . $txt[$label] . '</strong>' : '');

just remove the strong tags there, do note this will apply to all themes that use "use_buttons"

James Gryphon

It works!

You have my gratitude. This was driving me insane.

Antechinus

Quote from: Illori on November 15, 2016, 05:45:06 PM
sources/Subs.php

    return '<img src="' . $settings['images_url'] . '/buttons/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . ' />' . ($label != '' ? '<strong>' . $txt[$label] . '</strong>' : '');

just remove the strong tags there, do note this will apply to all themes that use "use_buttons"

Ah, so this is what you were referring to in the other thread. Hadn't noticed it before, and it's definitely an oversight that shouldn't have made it through beta. The buttons have bold font declared in the CSS anyway, which is where it should be.

Anyway, it doesn't affect James' other question about backgrounds and icons. And the same code is called for default/Curve since that also has $settings['use_buttons'] = true; in index.template.php.

Illori

Quote from: Antechinus on November 22, 2016, 09:34:40 PM
Anyway, it doesn't affect James' other question about backgrounds and icons. And the same code is called for default/Curve since that also has $settings['use_buttons'] = true; in index.template.php.

then strange as in curve it does not have the text in bold like that code would suggest. so things must be different in how curve is coded in this area vs core.

Antechinus

Curve does have the text in bold. It's just not obvious because of the small font size.

ul.quickbuttons
{
margin: 0.9em 11px 0 0;
clear: right;
float: right;
text-align: right;
font: bold 0.85em arial, sans-serif;
}


Anyway I looked a bit closer and you're right about them being different.

Example button markup from Curve:

// Can they reply? Have they turned on quick reply?
if ($context['can_quote'] && !empty($options['display_quick_reply']))
echo '
<li class="quote_button"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');">', $txt['quote'], '</a></li>';


And the same button from Core:

// Can they reply? Have they turned on quick reply?
if ($context['can_quote'] && !empty($options['display_quick_reply']))
echo '
<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');">', $reply_button, '</a></li>';


So the ', $reply_button, ' is what's pulling the strong tags, etc from Subs. Beats me why it was done this way. I honestly can't remember every detail of the dev decisions way back then. I do remember that we spent less time and energy on Core, so it probably has all sorts of daft crud left in it.

This difference in buttons isn't directly related to $settings['use_buttons'] = true; in index.template.php, because both themes are identical there. TBH the best option would be to just rip the code from Curve and use that instead. It's far more versatile.

Advertisement: