TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

June 10, 2023, 11:15:07 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 194,368
  • Total Topics: 21,157
  • Online today: 83
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 1
Guests: 62
Total: 63

Menu tab not 'active' when on TinyPortal Frontpage

Started by roguetrooper, April 19, 2011, 04:41:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

roguetrooper


Link to my site: http://www.menefrego.co.uk/community
SMF version: 1.1.11
TP version: 1.0 Beta 5-1
Default Forum Language: English
Theme name and version: Af314
Browser Name and Version: Tested on all browsers current versions
Mods installed: None save TP

Hey guys,

I've spent a few days looking through the search function for an answer to this both here and at the SMF Support Forums but haven't found one as yet (if there is one I'm sorry!).

My forum is at menefrego.co.uk/community

It's running SMF1.1.11 with Tinyportal 1.0 Beta 5-1 and has the AF316 theme.

I followed the instructions to add a new menu tab as found here. However from what I've read the reason that the menu tab (HOME) isn't highlighting when active is because it is not actually an action and is operating outside the forum.

Is there any way to make the HOME button active when on the TinyPortal Frontpage?

The code I'm using is as follows:

$current_action = 'BoardIndex';
   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')))
   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';
//Dan additions for adding menu items as current actions (TP)
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 2)
      $current_action = 'aboutus';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 3)
      $current_action = 'history';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 4)
      $current_action = 'events';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 5)
      $current_action = 'gallery';


I have tried, using a suggestion from the same SMF Support Topic linked above, the following as well but to no avail.

        if ($_SERVER['REQUEST_URI']=='/')
$current_action = 'frontpage';


Any help for a new guy? Ha ha.

Thanks for looking.

Rogue Trooper

Related Error messages: None as yet

ZarPrime

Hello roguetrooper,

Welcome to the TP Support Site.

Quote from: roguetrooper on April 19, 2011, 04:41:34 PM
Is there any way to make the HOME button active when on the TinyPortal Frontpage?

I just looked at your site and it looks like the Home button is indeed highlighted when you are on the FrontPage so I'm somewhat confused.  The tab that looks like it's not highlighted properly is the Forum tab when you are on the Forum BoardIndex.  Can you give us an update on this.

In the meantime, this link might give you some additional information --> How to add a Home button or a new tab?

ZarPrime

roguetrooper

Thanks for getting back to me ZarPrime!

As it happens I kept mucking around with things until I found a work around.

Full details are here.

However, in essence, I returned all function to 'board and' then made a specific frontpage call using:

   
if (isset($_REQUEST['frontpage']) && $_REQUEST['frontpage'] == 0)
      $current_action = 'home';


I'm completely new to all coding, so I'm not sure if that's the best way to do things - but it seems to be working for now ha ha.

Cheers,
RT

ZarPrime

RT,

OK, well, it's certainly somewhat unorthodox the way you did it but I agree that it seems to be working, although strangely.  In fact, with this link --> http://www.menefrego.co.uk/community/

The Forum tab is highlighted but when you hit the home tab to go to this link --> http://www.menefrego.co.uk/community/index.php?frontpage;p=0

... it gives the same result except the home tab is now highlighted.  I've got to admit, I've never actually seen that work but as long as you aren't getting errors and it's working for you, I guess it's OK.

The problem is that different theme authors have different methods of coding their navbar.  Overall, the best method is to ask the theme author to help you with this.  The link I gave you in my post above works for most people but not everybody.  Anyway, we'll mark this topic solved for now so, if you have any further issues with it, just let us know and we'll try to help.

ZarPrime

roguetrooper

Bugger.

As it happens, once I checked the forum errors each page is making error relating to the hack code job I did ha ha.

I'm retrying to code it now however whilst I can get the home page to become active when using

if ($context['current_action']=='')
      $current_action = 'home';


This also means that any none action, such as topics and posts, become classified as Home rather than the forum.

roguetrooper

Cancel that -

All fixed now. Not sure how I did it, but it appears to be working... must've set the correct thing somewhere ha ha.

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

   // 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')))
   if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'Forum', 'tpadmin')))
      $current_action = $context['current_action'];

  if (isset($_GET['dl']))
      $current_action = 'dlmanager';

   if (isset($_GET['board']) || isset($_GET['topic']) || $context['current_action']=='forum')
      $current_action = 'forum';

   if ($context['current_action']=='tpadmin')
      $current_action = 'admin';

   if ($context['current_action'] == 'theme')
      $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

//Dan additions for adding menu items as current actions (TP)
   //if ($context['current_action']=='')
      //$current_action = 'home';
   if ($context['current_action']=='calendar')
      $current_action = 'calendar';
   if ($context['current_action']=='pm')
      $current_action = 'pm';
   if ($context['current_action']=='profile')
      $current_action = 'profile';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 2)
      $current_action = 'aboutus';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 3)
      $current_action = 'history';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 4)
      $current_action = 'events';
   if (isset($_REQUEST['page']) && $_REQUEST['page'] == 5)
      $current_action = 'gallery';
   if (isset($_REQUEST['cat']) && $_REQUEST['cat'] == 8)
      $current_action = 'home';

ZarPrime

Ah, yes.  It looks like it is highlighting correctly now.  Good job. O0

BTW, I hate to say this now that you have got it working correctly but at some point you should upgrade your Forum to the latest version of SMF and TinyPortal at some point since there are security fixes and bugs corrected for the latest versions.  Ah, now that I looked again, it does look like you did indeed upgrade to SMF 1.1.13 which is good.  The latest version of TP also works with SMF 2.0 RC5, for future reference. ;)

ZarPrime

roguetrooper

Heh, yep - updated after someone mentioned it elsewhere. Thanks for looking it over and cheers for reading my ramblings ha ha!