News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

New post - Different color?

Started by tennis4you, October 05, 2007, 08:57:59 PM

Previous topic - Next topic

tennis4you

Right now I have the code modified such that any time there is a new post in a topic the topic heading is bold.  It helps people find the new posts quicker.

But is there a way to make the text in the subject heading a different color as well?  That would be even sweeter!

Thanks!

guppy

Have you tried to add the color code to your modified code the way you added bold?

tennis4you

No, I am not 100% sure how to do that.  I just followed someone's instructions on how to do it.  They just had me remove a little code.  Makes it much easier to see the new posts though.  :)

codenaught

In the future please bump your original topics instead of starting new ones.

You seem to have more or less the same question in two places already:

http://www.simplemachines.org/community/index.php?topic=195070.0 (Except with bold)
http://www.simplemachines.org/community/index.php?topic=195044.0 (Same question)

The reason I didn't answer before is because I am having trouble figuring this out. I knew the code needed to check if the topic has a new post, but no matter what I seemed to do it wouldn't change the color of the link.

But I have figured out one way to do it now.

Add in Themes/<theme_name>/style.css:

.newpost a:link, .newpost a:visited
{
color: red;
}


And in Themes/<theme_name>/MessageIndex.template.php:

Change this:
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>


To this:

echo '
<tr ' . ($topic['new'] ? 'class="newpost"' : '') . '>
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
Dev Consultant
Former SMF Doc Coordinator

tennis4you

Sorry about the repeat topics.  I would have bumped it if I had known.  I always figured it was easier for someone to read one post with the request than to sort through several posts.  It is my bad.

This worked great, you are amazing!

shumar

Hm, but this is doesn't work for me. :(
What is wrong ??
For now I have only little picture new that present new message.
Here how my MessageIndex.template.php looking.

echo '
<tr ' . ($topic['new'] ? 'class="newpost"' : '') . '>
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="4%">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="windowbg' , !empty($settings['seperate_sticky_lock']) && $topic['is_sticky'] ? '3' : '' , '" valign="middle" ', (!empty($topic['quick_mod']['remove']) ? 'id="topic_' . $topic['first_post']['id'] . '" onmouseout="mouse_on_div = 0;" onmouseover="mouse_on_div = 1;" ondblclick="modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\', \'' . $context['session_id'] . '\');"' : ''), '>';


I added this too on my style.css:
/* Promena boje naslova novog posta */
.newpost a:link, .newpost a:visited
{
color: red;
}

But subjects of new messages are still blue. :(

shumar

I wish that subject of new post in thread be different color, not subjec of thread in forum,

Advertisement: