• Welcome to Simple Machines Community Forum. Please login or sign up.
December 06, 2021, 02:00:09 PM

News:

SMF 2.1 RC4 has been released! Try it out and help us test! :) Read more.


Hide page index if there is only one page.

Started by 1MileCrash, November 24, 2007, 04:57:11 PM

Previous topic - Next topic

1MileCrash

November 24, 2007, 04:57:11 PM Last Edit: December 12, 2007, 10:46:32 PM by SleePy
As answered in this topic.

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.
The only thing php can't do is tell you how much milk is left in the fridge.



Advertisement: