News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Hide the "Pages: [1]" if there is only one...

Started by dannbass, November 23, 2007, 10:35:54 PM

Previous topic - Next topic

dannbass

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!

1MileCrash

Good idea! I'll do this now and probabally use it myself. Do you want it gone completely or to say "Page: [1]"?
The only thing php can't do is tell you how much milk is left in the fridge.



1MileCrash

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



1MileCrash

Glad i could help, I might include your idea on my next theme if you don't mind.  ;D
The only thing php can't do is tell you how much milk is left in the fridge.



Advertisement: