Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: 1MileCrash on November 24, 2007, 04:57:11 PM

Title: Hide page index if there is only one page.
Post by: 1MileCrash on November 24, 2007, 04:57:11 PM
As answered in this topic (http://www.simplemachines.org/community/index.php?topic=207404.0).

This hides the "Pages: [1]" completely if there is only one page and therefore useless.

You will have to edit templates individually (messageindex.template, display.template) if want the change in more than one place.

For example, to make this work on message index, find the following:

<table cellpadding="3" cellspacing="0" width="100%">
                  <tr>
                     <td><b>', $txt[139], ':</b> ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a href="#bot">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_down.gif" alt="' . $txt['topbottom5'] . '" align="top" />' : $txt['topbottom5']) . '</a>' : '', '</td>
                     <td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller; white-space: no-wrap">', theme_show_buttons(), '</td>
                  </tr>
               </table>


Replace it with this:

';
if($context['page_index'] == '[<b>1</b>] ')
{
echo'  <table cellpadding="3" cellspacing="0" width="100%">
                  <tr>
                     <td>', !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a href="#bot">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_down.gif" alt="' . $txt['topbottom5'] . '" align="top" />' : $txt['topbottom5']) . '</a>' : '', '</td>
                     <td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller; white-space: no-wrap">', theme_show_buttons(), '</td>
                  </tr>
               </table>';
}
else
{
echo'  <table cellpadding="3" cellspacing="0" width="100%">
                  <tr>
                     <td><b>', $txt[139], ':</b> ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a href="#bot">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_down.gif" alt="' . $txt['topbottom5'] . '" align="top" />' : $txt['topbottom5']) . '</a>' : '', '</td>
                     <td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller; white-space: no-wrap">', theme_show_buttons(), '</td>
                  </tr>
               </table>';
}

echo'


And page index will be gone if there is only one page.