Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

January 22, 2021, 05:32:15 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 191741
  • Total Topics: 20939
  • Online Today: 62
  • Online Ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 42
Total: 43

Author Topic: Menu tab not 'active' when on TinyPortal Frontpage  (Read 9916 times)

0 Members and 1 Guest are viewing this topic.

Offline roguetrooper

  • Jr. Member
  • **
  • Posts: 7
Menu tab not 'active' when on TinyPortal Frontpage
« on: April 19, 2011, 09:41:34 AM »

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:

Code: [Select]
$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.

Code: [Select]
        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
« Last Edit: April 21, 2011, 06:30:48 AM by ZarPrime »

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #1 on: April 20, 2011, 09:25:11 PM »
Hello roguetrooper,

Welcome to the TP Support Site.

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

Offline roguetrooper

  • Jr. Member
  • **
  • Posts: 7
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #2 on: April 21, 2011, 04:09:52 AM »
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:

Code: [Select]
   
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

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #3 on: April 21, 2011, 06:30:38 AM »
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

Offline roguetrooper

  • Jr. Member
  • **
  • Posts: 7
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #4 on: April 21, 2011, 07:18:44 AM »
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

Code: [Select]
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.

Offline roguetrooper

  • Jr. Member
  • **
  • Posts: 7
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #5 on: April 21, 2011, 07:35:33 AM »
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.

Code: [Select]
// 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';

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #6 on: April 21, 2011, 08:11:23 AM »
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

Offline roguetrooper

  • Jr. Member
  • **
  • Posts: 7
Re: Menu tab not 'active' when on TinyPortal Frontpage
« Reply #7 on: April 21, 2011, 08:37:58 AM »
Heh, yep - updated after someone mentioned it elsewhere. Thanks for looking it over and cheers for reading my ramblings ha ha!