TinyPortal

Development => Support => Topic started by: jehod on February 16, 2007, 11:01:07 AM

Title: "Active Tab"
Post by: jehod on February 16, 2007, 11:01:07 AM
Hi,

I recently added a new main menu item in my forum which links to an article instead of a "?action=" line.

An example of my code:

// Show the [Squads] button.
echo ($current_action == 'squads' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'squads' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?page=39">Squads</a>
</td>' , $current_action == 'squads' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


When I click on my new menu item, it takes me to the article as expected, however the tab is not "active", the home tab is. So I'm wondering, is there a way to get this new menu item to show as active?

I appreciate any help.
Title: Re: "Active Tab"
Post by: akulion on February 16, 2007, 11:05:12 AM
ull have to add it to the butons array


if (in_array($context['current_action'], array('links','search', 'admin', 'arcade','calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))
$current_action = $context['current_action'];


in the above ull have to put in squads anywhere like this

'links','search', 'admin', 'squads', 'arcade','calendar',
Title: Re: "Active Tab"
Post by: jehod on February 16, 2007, 01:18:44 PM
Thanks for the suggestion. I checked that line and it appears to already be in place. Here's my code:

if (in_array($context['current_action'], array('search', 'arcade', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'squads', 'staff', 'pm', 'forum', 'tpadmin')))
$current_action = $context['current_action'];


Can you think of anything else that I might be overlooking?
Title: Re: "Active Tab"
Post by: IchBin on February 16, 2007, 01:52:36 PM
In your URL when you access the squads page does is actually have index.php?action=squads  ???

If not, that is why it won't be active. It actually has to be defined as an action for it to pick up the place you are in the forum in order to make the "Active Tab".
Title: Re: "Active Tab"
Post by: jehod on February 16, 2007, 02:44:04 PM
Nope, it goes directly to the article "page=x". Is there some way to make it work with my article?

Edit:  I do see what you mean by it having to be "action=" to kick in.
Title: Re: "Active Tab"
Post by: IchBin on February 16, 2007, 06:57:16 PM
I don't know of any way to make an article work with the current action.
Title: Re: "Active Tab"
Post by: jehod on February 16, 2007, 10:48:03 PM
Ok, thanks anyways though. What I will probably have to do is move my code off the article so I can use an action.
Title: Re: "Active Tab"
Post by: IchBin on February 16, 2007, 10:59:28 PM
How to create a Custom Action.
http://www.simplemachines.org/community/index.php?topic=23864.0
Title: Re: "Active Tab"
Post by: akulion on February 17, 2007, 07:49:25 AM
u know when bloc comes back we could ask him about this

Since I think it wont be that hard to define an array for Page=

It should be the same way as the index, Ill try and study it in his absence to see if I can come up with something. If not then maybe he can help us with it.

aku