SimplePortal

Support => English Support => Topic started by: yitsu on August 28, 2011, 05:35:55 PM

Title: Navi Problem
Post by: yitsu on August 28, 2011, 05:35:55 PM
Hello,
Im Yisu and i need some help.
My tabs in the navigator stay on home
http://phoenixeffect.net/forum
Click on Donate or Downloads
Here are my tabs:
      
   
Code: [Select]
'donate' => array(
'title' => 'Donate',
'href' => $scripturl . '?page=donate',
'show' => true,
'sub_buttons' => array(
),
),
'downloads' => array(
'title' => 'Downloads',
'href' => $scripturl . '?page=downloads',
'show' => true,
'sub_buttons' => array(
),
Title: Re: Navi Problem
Post by: AngelinaBelle on August 29, 2011, 10:36:32 AM
First step:  you have added buttons to the menu. Good.
Second step: tell it how to know the button is active.
This is easy to to do.
In Subs.php, find
Code: [Select]
// Figure out which action we are doing so we can set the active tab.See a lot of if statements after that. You will add one.
Something like the following should work.  Please test it.

Code: [Select]
$my_special_pages = array(
                'donate' => 'Donate',
                'downloads', 'Downloads'
);
if  ( !empty($_GET['page'])  )
{
      $index = array_search($_GET['page'], $my_special_pages);
      if ( $index !== FALSE )  $current_action = $my_special_pages[$index];
}
Title: Re: Navi Problem
Post by: ccbtimewiz on August 29, 2011, 11:56:55 AM
Could rewrite this portion:
Code: [Select]
if  ( !empty($_GET['page'])  )
{
      $index = array_search($_GET['page'], $my_special_pages);
      if ( $index !== FALSE )  $current_action = $my_special_pages[$index];
}

As this:
Code: [Select]
if (!empty($_REQUEST['page']))
{
if (array_interesect($my_special_pages, $_REQUEST['page']))
$current_action = $_REQUEST['page'];
}

Title: Re: Navi Problem
Post by: yitsu on August 29, 2011, 03:19:03 PM
First one dont change anything second one error at the search function
Title: Re: Navi Problem
Post by: yitsu on August 29, 2011, 03:50:50 PM
Can some one else help me please,
also thank you for reply me.
Title: Re: Navi Problem
Post by: yitsu on August 29, 2011, 04:02:35 PM
Got it,
Code: [Select]
$my_special_pages = array(
                'donate' => 'Donate',
                'downloads', 'Downloads'
);
if  ( !empty($_GET['page'])  )
{
  $index = array_search($_GET['page'], $my_special_pages);
  if ( $index !== FALSE )  $current_action = $my_special_pages[$index];
}
need to be this:
Code: [Select]
$my_special_pages = array(
                'donate', 'Donate',
                'downloads', 'Downloads'
);
if  ( !empty($_GET['page'])  )
{
  $index = array_search($_GET['page'], $my_special_pages);
  if ( $index !== FALSE )  $current_action = $my_special_pages[$index];
}
Title: Re: Navi Problem
Post by: ccbtimewiz on August 29, 2011, 04:20:49 PM
Open ./Sources/Subs.php

Find:
Code: [Select]
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';

Replace with:
Code: [Select]
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';

$my_special_pages = array('donate', 'downloads');

if (!empty($_REQUEST['page']))
{
if (array_interesect($my_special_pages, $_REQUEST['page']))
$current_action = $_REQUEST['page'];
}
Title: Re: Navi Problem
Post by: AngelinaBelle on August 29, 2011, 06:55:06 PM
Sorry for the typo.
Code: [Select]
$my_special_pages = array(
                'donate' => 'Donate',
                'downloads' => 'Downloads'
   );
   if  ( !empty($_GET['page'])  )
   {
        $index = array_search($_GET['page'], $my_special_pages);
        if ( $index !== FALSE )  $current_action = $my_special_pages[$index];
   }
Title: Re: Navi Problem
Post by: AngelinaBelle on August 30, 2011, 09:46:53 AM
yitsu,
Please don't post the same question here and at simplemachines.org at the same time. This means you have at least two people working independently on your problem.
You can see that the solution I came up with here is almost exactly the same as the one IchBin came up with over there. Except his is for only the one button, and is simpler. I am not certain now if the difference between 'downloads' and 'Downloads' is important for setting current_action.
http://www.simplemachines.org/community/index.php?topic=450531.msg3147321#msg3147321 (http://www.simplemachines.org/community/index.php?topic=450531.msg3147321#msg3147321)
All in all, you are probably better off with IchBin's solution.
Title: Re: Navi Problem
Post by: ccbtimewiz on August 30, 2011, 07:09:50 PM
My solution does the same except lets you define more pages. :P
Title: Re: Navi Problem
Post by: AngelinaBelle on August 31, 2011, 12:27:51 PM
He's a beginner, I think. The simpler solution is probably best for the first try.
SimplePortal 2.3.8 © 2008-2024, SimplePortal