SimplePortal
Support => English Support => Topic started 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:
'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(
),
-
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
// 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.
$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];
}
-
Could rewrite this portion:
if ( !empty($_GET['page']) )
{
$index = array_search($_GET['page'], $my_special_pages);
if ( $index !== FALSE ) $current_action = $my_special_pages[$index];
}
As this:
if (!empty($_REQUEST['page']))
{
if (array_interesect($my_special_pages, $_REQUEST['page']))
$current_action = $_REQUEST['page'];
}
-
First one dont change anything second one error at the search function
-
Can some one else help me please,
also thank you for reply me.
-
Got it,
$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:
$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];
}
-
Open ./Sources/Subs.php
Find:
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';
Replace with:
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'];
}
-
Sorry for the typo.
$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];
}
-
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.
-
My solution does the same except lets you define more pages. :P
-
He's a beginner, I think. The simpler solution is probably best for the first try.