Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: forumfjott on November 19, 2013, 10:50:49 AM

Title: New topic bold text
Post by: forumfjott on November 19, 2013, 10:50:49 AM
Hi
I have several requests of making the topic text you can click to show latest post viewing from forum main page, bold.
They do understand that there is other methods to be directed to the latest post, but while skimming fora, they intend to click this link between the posters name and the time posted.

Nyeste innlegg av E****d T****d    <----Name (hidden here)
i Sv: Euroscope - Norway N...            <--------This line with bold fonts/text (mind the norwegian language)
på I går kl. 23:32:01                          <--------Time for newest post


Hope there is a easy way to accommodate their wishes and you gurus show me where to put the BOLD code/command. 
Title: Re: New topic bold text
Post by: margarett on November 19, 2013, 02:28:55 PM
What theme are you using? If non-default, does it have a MessageIndex.template.php?
Title: Re: New topic bold text
Post by: forumfjott on November 19, 2013, 03:50:43 PM
I only have default and core (EDIT) and yes, i do have messageindex.template
Title: Re: New topic bold text
Post by: margarett on November 19, 2013, 04:27:24 PM
OK.

Just to make it clear, you want the topic subject to be bold when the "new" orange button (http://media.simplemachinesweb.com/smf/default/images/english-utf8/new.gif) is shown?
Title: Re: New topic bold text
Post by: forumfjott on November 20, 2013, 05:37:58 AM
not quite.
This option to jump to newest post is only from the main page, like this: http://www.simplemachines.org/community/

If you look at the top forum, News and Updates, you can jump to newest post by clicking:  Re: SMF 1.1.19 and 2.0.6...

This is the text I want with bold letters/font, like:

Last post by talktoanil
in Re: SMF 1.1.19 and 2.0.6...
on November 16, 2013, 10:27:39 AM

:D
Title: Re: New topic bold text
Post by: margarett on November 20, 2013, 08:07:31 AM
You have strange members :P
BoardIndex.template.php, find:

if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

Replace with:

if (!empty($board['last_post']['id']))
{
echo '
<p>', $txt['last_post'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />';
if ($board['new'] || $board['children_new'])
echo $txt['in'], ' <strong>', $board['last_post']['link'], '</strong><br />';
else
echo $txt['in'], ' ', $board['last_post']['link'], '<br />';
echo $txt['on'], ' ', $board['last_post']['time'],'
</p>';
}
Title: Re: New topic bold text
Post by: forumfjott on November 20, 2013, 08:23:30 AM
works like a charm!!

Thanks a lot

PS: 15000 views in a few days??? wow
Title: Re: New topic bold text
Post by: Adraiam on February 14, 2015, 11:38:09 AM
Quote from: margarett on November 20, 2013, 08:07:31 AM
You have strange members :P
BoardIndex.template.php, find:

if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';

Replace with:

if (!empty($board['last_post']['id']))
echo '
<p>', $txt['last_post'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />';
if ($board['new'] || $board['children_new'])
echo $txt['in'], ' <strong>', $board['last_post']['link'], '</strong><br />';
else
echo $txt['in'], ' ', $board['last_post']['link'], '<br />';
echo $txt['on'], ' ', $board['last_post']['time'],'
</p>';


Sorry to revive this topic, but I have a problem with the code. It works perfectly, but in forums without messages appears "N/D". Can someone help me, please?

(http://i.imgur.com/9hYJ8Ua.png)

Sorry for my english, and thanks!
Title: Re: New topic bold text
Post by: margarett on February 14, 2015, 12:54:51 PM
Hi and welcome to sm.org ;)

You shouldn't continue another person's topic, especially one that is marked as solved as it can be skipped by people providing support ;)

That being said... How does it show without this code? I'm not on the computer now so I can't check, but I would guess that it works the same because the code I added doesn't change the text which is shown, just bold it when there are new posts inside that board...
Title: Re: New topic bold text
Post by: Adraiam on February 14, 2015, 01:08:31 PM
Thanks for the welcome, and sorry for continue this topic :(

Without this code doesn't show "N / D" in the forums without messages :

(http://i.imgur.com/riIDrQl.png)
Title: Re: New topic bold text
Post by: margarett on February 14, 2015, 02:28:05 PM
It shouldn't... But I think I see why, let me try it at the computer, but only tomorrow ;)

And I'm sorry, you did good in reviving this topic as I'm pretty sure the code is buggy :(
Title: Re: New topic bold text
Post by: Adraiam on February 14, 2015, 05:15:56 PM
I'll wait then. Thank you again, margarett!
Title: Re: New topic bold text
Post by: Mortissimov on February 14, 2015, 05:41:44 PM
Edit the code like this:

if (!empty($board['last_post']['id']))
echo '
<p>', $txt['last_post'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' <strong>', $board['last_post']['link'], '</strong><br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
Title: Re: New topic bold text
Post by: Adraiam on February 14, 2015, 08:06:51 PM
Hey navMartin,

Your code always shows the topic in bold. I just need bold to new topics, but thank you anyway  ;)
Title: Re: New topic bold text
Post by: Steve on February 14, 2015, 09:15:30 PM
I'm going to mark this unsolved then so this thread isn't skipped over until Bruno gets a chance to look at his code. :)
Title: Re: New topic bold text
Post by: Mortissimov on February 15, 2015, 06:10:24 AM
Ok sorry, i was too tired. This code is working perfect for me.

if (!empty($board['last_post']['id'])) {
if ($board['new'] || $board['children_new']) {
echo '
<p>', $txt['last_post'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' <strong>', $board['last_post']['link'], '</strong><br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
} else {
if (!empty($board['last_post'])) {
echo '
<p>', $txt['last_post'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
} else {
echo '';
}
}
}
Title: Re: New topic bold text
Post by: Steve on February 15, 2015, 08:46:59 AM
Who marked the topic solved again, may I ask?
Title: Re: New topic bold text
Post by: Illori on February 15, 2015, 08:59:25 AM
opps, i did not notice that it was not the op that said it was working.

maybe if the topic was split from what was a bump we could figure out who has what solved.
Title: Re: New topic bold text
Post by: Steve on February 15, 2015, 09:26:03 AM
Hmm ... that gives me an idea ... :P
Title: Re: New topic bold text
Post by: Adraiam on February 15, 2015, 09:31:50 AM
NavMartin, your code works perfectly without errors, you're the best  :-*

Thank you all for the help!
Title: Re: New topic bold text
Post by: Steve on February 15, 2015, 09:36:50 AM
Marking solved again. :P
Title: Re: New topic bold text
Post by: Illori on February 15, 2015, 10:40:35 AM
Quote from: Steve on February 15, 2015, 09:36:50 AM
Marking solved again. :P

but the op has never said this solved their problem from a few years ago.
Title: Re: New topic bold text
Post by: margarett on February 15, 2015, 10:42:40 AM
Yes, he did ;) The topic was marked solved before ;)
Title: Re: New topic bold text
Post by: margarett on February 15, 2015, 06:22:46 PM
For future reference, I fixed the original code ;) There were just missing brackets,