Well, i've made a custom menu tab (roster) linking to a custom article(page=2).
However when i'm on this "roster" page my roster menu tab is not highlighted, as instead the home button stays lit.
Does anybody know howto fix this problem? I've used these codes in my index.php & my index.template.php (i'm using ds-natural theme).
index.php
// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array(
'roster' => array('?page=2', 'roster'),
'activate' => array('Register.php', 'Activate'),
index.template.php
// 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 ($context['current_action'] == 'roster')
$current_action = 'roster';
I've already asked other people about this and they say my page=2 does not have class="current"
in it. My website is http://www.erion-eu.co.nr incase if you wanted to check it out for yourself :).
Thanks alot,
B
$context['current_action'] only picks up action= in your url. So your URL HAS TO actually have action=roster for your button to be highlighted. In order to fix this you have to add some custom coding to your menu code.
if(isset($_GET['page']) && $_GET['page'] == '2')
$current_action='roster';
Then in your button code, just make sure it is set to roster for all the current_action stuff.
Quote from: IchBinâ„¢ on April 03, 2010, 08:09:33 PM
$context['current_action'] only picks up action= in your url. So your URL HAS TO actually have action=roster for your button to be highlighted. In order to fix this you have to add some custom coding to your menu code.
if(isset($_GET['page']) && $_GET['page'] == '2')
$current_action='roster';
Then in your button code, just make sure it is set to roster for all the current_action stuff.
So are these 2 codes correct?
index.php
// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array(
'roster' => array('roster', 'roster'),
'activate' => array('Register.php', 'Activate'),index.template.php
// 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(isset($_GET['page']) && $_GET['page'] == '2')
$current_action='roster';
thanks!
There's no need to add that code to the index.php file unless you are writing a custom page for SMF. Since you're using an article, all you need is the code I posted, and your button code.
Quote from: IchBinâ„¢ on April 03, 2010, 08:14:33 PM
There's no need to add that code to the index.php file unless you are writing a custom page for SMF. Since you're using an article, all you need is the code I posted, and your button code.
Edit: It worked! Thanks alot mate!
If i wanted to redirect a tab to the action "tpmod;dl=cat2"
(http://neotrix.justforfun-gaming.co.cc/siteke/index.php?action=tpmod;dl=cat2)
How would this work out in the coding then?
Cheers!
So you want your tab highlighted when someone clicks on that link?
You can do the same thing with dl.
if (isset($_GET['ld']) && $_GET['dl'] == '2')
$current_action="mylink";
Then your button code needs to say mylink in all the appropriate places.
Quote from: IchBinâ„¢ on April 03, 2010, 08:55:46 PM
So you want your tab highlighted when someone clicks on that link?
You can do the same thing with dl.
if (isset($_GET['ld']) && $_GET['dl'] == '2')
$current_action="mylink";
Then your button code needs to say mylink in all the appropriate places.
hmmm this one doesnt work.
I've used :
if (isset($_GET['ld']) && $_GET['dl'] == '2')
$current_action="addons";// Show the [Addons] button.
echo '<li><a' , $current_action=='addons' ? ' class="current"' : '' , ' href="', $scripturl, '?action=tpmod;dl=cat2"><span>' , 'addons' , '</span></a></li>';
There is a mistake in my code. Try this instead:
if (isset($_GET['dl']) && $_GET['dl'] == 'cat2')
$current_action="addons";
Quote from: IchBinâ„¢ on April 04, 2010, 05:13:49 AM
There is a mistake in my code. Try this instead:
if (isset($_GET['dl']) && $_GET['dl'] == '2')
$current_action="addons";
Hmm it still doesn't work ;$
My website is Http://neotrix.justforfun-gaming.co.cc/siteke
Have you got any idea?
thanks alot for helping me out
Edited my code before your last post. Sorry, I need to pay more attention to the code you show apparently... :)
Quote from: IchBinâ„¢ on April 04, 2010, 06:41:43 PM
Edited my code before your last post. Sorry, I need to pay more attention to the code you show apparently... :)
I hate to say this but it's still not working :(
"index.php?action=tpmod;dl=cat2" don't we have to include the "tpmod" aswell into the coding?
Sorry for bothering you this much and thanks alot for helping me out!
Might be better if you just attach your index.template.php file. There's shouldn't be any reason to check for tpmod. That, or just paste your template_menu() function into some code tags here.
Quote from: IchBinâ„¢ on April 05, 2010, 03:39:06 PM
Might be better if you just attach your index.template.php file. There's shouldn't be any reason to check for tpmod. That, or just paste your template_menu() function into some code tags here.
Here you go , I've attached it.
thanks
Try this one.