SMF Support > SMF 2.0.x Support

How to display "Show unread posts since last visit" in custom themes?

<< < (2/3) > >>

Vahid‎‎ ‎Damanafshan:
Thanks but when I use your code, I get the following error:

--- Code: --- Template Parse Error!

There was a problem loading the /Themes/Vertex-Theme2-0-2-v1-2/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'
--- End code ---

Shambles:
^ try adding an apostrophe at the end of this line


--- Code: ---<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
--- End code ---

thus


--- Code: ---<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>';
--- End code ---

Vahid‎‎ ‎Damanafshan:

--- Quote from: Shambles™ on June 26, 2012, 06:40:34 AM ---^ try adding an apostrophe at the end of this line


--- Code: ---<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>
--- End code ---

thus


--- Code: ---<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>';
--- End code ---

--- End quote ---
Ok, it solved the problem. But another problem showed up: As you see in the attached picture, both of these buttons is behind the forum' logo. How to solve this problem?

Krash.:

Ok, this should do it -

In index.template.php:


--- Code: ---
function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
global $user_info;

echo '
<div class="header">
<div class="header_topbar">
<div class="header_topbar_content" style="width: ' . $settings['forum_width'] . '">
<div class="topbar_floatleft_holder">

<div class="floatright">
';
/// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
', $txt['vp_help'] ,' ', $context['user']['name'], ' ', $txt['bar_symbol'] ,' <a href="', $scripturl ,'?action=pm">', $txt['view_inbox'] ,'</a> ', $txt['bar_symbol'] ,' <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><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a>
<br><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a>';
}


--- End code ---

In /css/index.css:


--- Code: ---
.header_topbar
{
width: 100%;
height: 60px;  /*/ 36px -> 60px */
background: #114f7e url(../images/vertex_image/topbar_bg.png);
background-repeat: repeat-x;
}

.header_topbar_content
{
margin: 0 auto;
display: table;
width: 100%;
line-height: 18px;  /*/ 36px -> 18px */
color: #ececec;
}

.header_topbar_content a:link, .header_topbar_content a:active, .header_topbar_content a:visited
{
color: #e1e1e1;
text-decoration: none;
float: right;  /*/ float right for Persian */
}


--- End code ---

You may have to adjust header_topbar height and line-height to accommodate your Persian font.  Looks like this in English:


Vahid‎‎ ‎Damanafshan:

--- Quote from: Krash. on June 26, 2012, 03:48:17 PM ---
Ok, this should do it -

--- End quote ---
Thank you so much, but one more thing:
The background colors of two button aren't the same, how can I solve this? Please accept my apologies for continuing to ask questions.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version