Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: dannbass on November 23, 2007, 10:35:54 PM

Title: Hide the "Pages: [1]" if there is only one...
Post by: dannbass on November 23, 2007, 10:35:54 PM
Hi! I'm wondering what will be the code for hiding the Pages:[1], if there is only one page... it's curious to see the plural if there is only 1 page.

Thanks for the help!
Title: Re: Hide the "Pages: [1]" if there is only one...
Post by: 1MileCrash on November 23, 2007, 10:48:19 PM
Good idea! I'll do this now and probabally use it myself. Do you want it gone completely or to say "Page: [1]"?
Title: Re: Hide the "Pages: [1]" if there is only one...
Post by: 1MileCrash on November 23, 2007, 11:06:04 PM
Alright, this works.

BTW, i did this to messageindex.template, so it will only work there. If you want this done to other places you'll need to make the change their too.

First, open up messageindex.template.php in the theme directory, and find this:

<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 the following:

';
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'
Title: Re: Hide the "Pages: [1]" if there is only one...
Post by: 1MileCrash on November 24, 2007, 04:46:14 PM
Glad i could help, I might include your idea on my next theme if you don't mind.  ;D