Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Flagrant by Crip - A few edits i need help with

Aloittaja richwig83, helmikuu 13, 2014, 08:04:04 AP

« edellinen - seuraava »

richwig83

Hi.

Im wondering if anyone can help me take a few items out of the standard menu bar as it comes standard. I managed to do it very easily on Crips Recursive theme runining v1.1.19... but this one on v2 is proving a little more complicated.

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '
      <div id="topnav">
         <ul>';

   foreach ($context['menu_buttons'] as $act => $button)
   {
      echo '
            <li id="button_', $act, '">
            <a class="', $button['active_button'] ? 'active ' : '', '" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '><span>', $button['title'], '</span></a>';

      if (!empty($button['sub_buttons']))
      {
         echo '
               <ul>';

         foreach ($button['sub_buttons'] as $childbutton)
         {
            echo '
                  <li>
                     <a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</a>';

            // 3rd level menus :)
            if (!empty($childbutton['sub_buttons']))
            {
               echo '
                     <ul>';

               foreach ($childbutton['sub_buttons'] as $grandchildbutton)
                  echo '
                        <li>
                           <a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>', $grandchildbutton['title'], '</a>
                        </li>';

               echo '
                  </ul>';
            }

            echo '
                  </li>';
         }
         echo '
               </ul>';
      }
      echo '
            </li>';
   }

   echo '
         </ul>
      </div><br class="clear" />';
}

// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $strip_options = array())
{
   global $settings, $context, $txt, $scripturl;

   if (!is_array($strip_options))
      $strip_options = array();

   // List the buttons in reverse order for RTL languages.
   if ($context['right_to_left'])
      $button_strip = array_reverse($button_strip, true);

   // Create the buttons...
   $buttons = array();
   foreach ($button_strip as $key => $value)
   {
      if (!isset($value['test']) || !empty($context[$value['test']]))
         $buttons[] = '
            <li><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="button_strip_' . $key . (isset($value['active']) ? ' active' : '') . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . $txt[$value['text']] . '</span></a></li>';
   }

   // No buttons? No button strip either.
   if (empty($buttons))
      return;

   // Make the last one, as easy as possible.
   $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);

   echo '
      <div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
         <ul>',
            implode('', $buttons), '
         </ul>
      </div>';
}

?>



Any help would be most welcome.

Thanks
Rich

Branko.

Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

richwig83

Ahh... sorted. subs.php...

Removed..

),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),


Rich

kat

For reference, you don't need to remove anything.

If you change:

'show' => true,

to

'show' => false,

it won't show. :)


richwig83

Brilliant. Thanks very much for your quick response.
"
Im also wanting to add a PM count and unread post count to the "userarea". Is that a simple fix?

kat

I believe the actual coding's not too difficult. But, I'd imagine that such things would increase your load and slow your forum down, quite considerably.

I'd be entirely happy for someone to tell me I'm wrong, about that, though. :)

richwig83

Ok thanks for your advice. That is definitely something we want to avoid.

IchBin™

You don't even need to change a source file for this. You can unset() or change the 'show' = false for the help button in the template_menu() function if you want to. Although, this only does it per theme. :)
IchBin™        TinyPortal

Advertisement: