SimplePortal

Customization => Themes and Graphics => Topic started by: asciident on December 09, 2009, 02:27:43 AM

Title: Forum button - updating block working out what page it's on
Post by: asciident on December 09, 2009, 02:27:43 AM
SMF 1.1.11 and SP 2.3.1 using "Back-n-Black" SMF theme by Crip - forum can be viewed at http://mutinyinc.net/

I have successfully added in the [Forum] button, but cannot seem to find a working fix for updating the section of code working out what page it's on to hightlight the appropriate menu button.  I have been searching and replacing code to no end and I cannot get it working -- home should be highlighted when on the portal page, forum should be highlighted when on the forum pages. The highlight works for all other buttons, since they were already there.

Here's the relevant bits from my index.template.php

Code: [Select]
   // Work out where we currently are.
   $current_action = 'home';
   if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
      $current_action = 'admin';
   if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
      $current_action = $context['current_action'];
   if ($context['current_action'] == 'search2')
      $current_action = 'search';
   if ($context['current_action'] == 'theme')
      $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

   // Are we using right-to-left orientation?
   if ($context['right_to_left'])
   {
      $first = 'last';
      $last = 'first';
   }
   else
   {
      $first = 'first';
      $last = 'last';
   }
        echo '<div id="tabs6">';

This part is working, but I thought I'd include it since I added it into the code and it's not normally part of the file...
Code: [Select]
   // How about the [forum] button?
       echo '<li', $current_action == 'forum' ? ' id="active"' : '', '><a href="', $scripturl, '?action=forum" ><span>', $txt['sp-forum'], '</span></a></li>';

I'm sure you're all quite sick of this type of question, but I'd be much obliged if anyone could point out how to make the first block of code work. Thanks much!
Title: Re: Forum button - updating block working out what page it's on
Post by: Nathaniel on December 10, 2009, 03:06:29 AM
Moved to the Themes and Graphics board.

It doesn't look like you have applied any of the SimplePortal code that deals with displaying the correct button. The 'Adding the 'Forum' action:' section of the General Custom Theme Tutorial (http://simpleportal.net/index.php?topic=148.0) lists the edits that you need to make.
SimplePortal 2.3.8 © 2008-2024, SimplePortal