Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Venera on August 15, 2013, 01:54:47 PM

Title: [TIP/TRICK] New Layout for "Replies / Views"
Post by: Venera on August 15, 2013, 01:54:47 PM
Hi,
I suggest a small change of default theme. It's not neccessary to repeat "Replies/Views" in the whole table with themes on Child bord, "Show unread posts sincce last visit" and "Show new replies to your posts" if it is in header of the tables yet. I put both old and new version, so you can see the difference between them and how much more is new version simply and elegant. ;)

Child Boards:

OLD                                          NEW
(http://i.imgur.com/wS2H11E.png)   (http://i.imgur.com/wNMhxry.png)

The following changes have to be done in message.template.php:


Find: <td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>



Replace with:
<td class="stats ', $color_class, '">
', $topic['replies'], ' / ', $topic['views'], '
</td>


"Show unread posts sincce last visit" and "Show new replies to your posts":

OLD                                        NEW
(http://i.imgur.com/GXLuFko.png)    (http://i.imgur.com/nPzMvPf.png)



In recent.template.php have be done changes because "/ Views" in header of the table are missing in

"Show unread posts since last visit":


Find: </th>
<th scope="col" width="14%" align="center">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';


Replace with: </th>
<th scope="col" width="14%" align="center">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> /
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';



and "Show new replies to your posts":

Find: </th>
<th scope="col" width="14%" align="center">
<a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';



Reblice with: </th>
<th scope="col" width="14%" align="center">
<a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] === 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> /
<a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] === views' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] === 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>';



... and make the same changes in two places in recent.template.php:
1st place for "Show unread posts sincce last visit"
2nd place for "Show new replies to your posts"

Find: </td>
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>



Replace with: </td>
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' / ', $topic['views'], '
</td>




:) Best regards for all and sorry for Englesh. :)
Title: Re: New Layout for "Replies / Views"
Post by: Shambles on August 15, 2013, 04:20:29 PM
Sounds an ideal candidate for the Tips & Tricks section ;)
Title: Re: New Layout for "Replies / Views"
Post by: Venera on August 16, 2013, 04:55:56 AM
Quote from: Shambles on August 15, 2013, 04:20:29 PM
Sounds an ideal candidate for the Tips & Tricks section ;)

Thanks!  :)
Title: Re: New Layout for "Replies / Views"
Post by: kat on August 16, 2013, 06:37:38 AM
Duly moved. :)
Title: Re: New Layout for "Replies / Views"
Post by: Dzonny on August 19, 2013, 05:26:08 AM
Thanks for a nice tip Venera :)
Title: Re: New Layout for "Replies / Views"
Post by: greak on August 23, 2013, 09:19:31 PM
nice tip
Title: Re: New Layout for "Replies / Views"
Post by: Venera on August 24, 2013, 01:32:23 AM
Thanks K@, Dzonny and greak.  :)