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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 703
  • Total: 704
  • tino

Problem with mainnav-active stuff...

Started by m3talc0re, March 18, 2008, 01:17:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

m3talc0re

I'm making a new theme of mine TP compatible, but for some reason, I can't get the mainnav active stuff to work for "forum". When at the portal "home", "home" is active. When you go to "forum", "home" is still active, not "forum"...

Here's the original TP code for home and forum:

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

if($settings['TPortal_front_type']!='boardindex')
// Show the [forum] button.
echo ($current_action=='forum' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action=='forum' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=forum">'.$txt['tp-forum'].'</a>
</td>' , $current_action=='forum' ? '<td class="maintab_active_last">&nbsp;</td>' : '';


Here's my code:

// Show the [home] button.
echo '
<td valign="middle" class="mainnav' , $current_action == 'home' ? '_active' : '' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>';

// Show the [forum] button.
if($settings['TPortal_front_type']!='boardindex')
echo '
<td valign="middle" class="mainnav' , $current_action == 'forum' ? '_active' : '' , '">
<a href="', $scripturl, '?action=forum">'.$txt['tp-forum'].'</a>
</td>';


Any idea? On the default template, it works. On mine, it does not.

Thanks.

IchBin

By default you should set $current_action = 'home'; I would put that code at the top of the template_menu function. Then if its actually anything else (like forum) then $current_action = 'forum';

Assign forum action by using php:
if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';


All other actions should already be defined in the array. I hope I explained that well. :)

m3talc0re

OOOhh, okay, I see what you're saying. I didn't even notice that TP added some extra parts up in that "// Work out where we currently are." part. Thanks Ich.

IchBin


This website is proudly hosted on Crocweb Cloud Website Hosting.