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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,990
  • Total Topics: 21,323
  • Online today: 1,579
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 654
  • Total: 655
  • lurkalot

Custom menu tab not highlighting issue (swf 1.1.11)

Started by neotrix, April 03, 2010, 06:42:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neotrix

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

IchBin

$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.

neotrix

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!

IchBin

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.

neotrix

#4
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!

IchBin

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.

neotrix

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>';

IchBin

#7
There is a mistake in my code. Try this instead:
if (isset($_GET['dl']) && $_GET['dl'] == 'cat2')
$current_action="addons";

neotrix

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

IchBin

Edited my code before your last post. Sorry, I need to pay more attention to the code you show apparently... :)

This website is proudly hosted on Crocweb Cloud Website Hosting.