Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: ViewFromTheBoundary - maaliskuu 16, 2014, 04:54:48 IP

Otsikko: Index.template.php help
Kirjoitti: ViewFromTheBoundary - maaliskuu 16, 2014, 04:54:48 IP
Hi,

I am trying to code the message part of this



How can I achieve this? It also turns red when you receive a message, how can I do this as well?

Thanks in advance :)
Otsikko: Re: Index.template.php help
Kirjoitti: TheKnown - maaliskuu 16, 2014, 04:56:05 IP
would need to know what you have at the moment.
Otsikko: Re: Index.template.php help
Kirjoitti: ViewFromTheBoundary - maaliskuu 16, 2014, 05:00:51 IP
At the moment I have

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo $txt['msg_alert_you_have'], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt['msg_alert_messages'] : $txt['message_lowercase'], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'] , '.<br />';


Which looks like this

Otsikko: Re: Index.template.php help
Kirjoitti: TheKnown - maaliskuu 16, 2014, 05:06:20 IP
try changing it to:

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
{
echo'
', $context['user']['unread_messages'], ' <a href="', $scripturl, '?action=pm"> ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'] , '</a>.<br />';
}
Otsikko: Re: Index.template.php help
Kirjoitti: ViewFromTheBoundary - maaliskuu 16, 2014, 05:11:23 IP
Thats just changed it to "0 are new."
Otsikko: Re: Index.template.php help
Kirjoitti: TheKnown - maaliskuu 16, 2014, 05:14:09 IP
try
// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
{
echo'
', $context['user']['unread_messages'], ' <a href="', $scripturl, '?action=pm"> ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'] , '</a> ', $txt['message_lowercase'], '.<br />';
}


you will also need to change some wording in if memory is correct index.english.php
Otsikko: Re: Index.template.php help
Kirjoitti: ViewFromTheBoundary - maaliskuu 16, 2014, 06:00:19 IP
Current I've got 0 new messages, but when i get a PM it says 1 new messages how can I get it to show 1 new message but then 2 new messages?