Small problem. After install, the forum seems to work fine. After entering via the home page, it operates correctly with the home tab in the menu selected.
When i choose forum however, the forum page loads but the home tab stays selected on the menu block. All other tabs work correctly until i come back to the forum, then the home tab shows selected again. At no time does the forum tab show as selected.
I'm using smf 1.1.4 with default theme.
This is a know bug that will be fixed some times when time allows.
The reason is that the home still have the action for the forum, but the home is now the frontpage of tp.
If you want to fix it now, i think there is one or two posts in here some where that explains how to. you should find them through a search :)
I have searched the forums as best I can and this is the only post I can find on this topic. Could you please provide a solution for this? I'm having the same issue. action,forum.html still returns "home" as the $current_action. I haven't been able to figure out how to fix this.
I figured out a solution.
// Show the [home] button.
echo '<li><a' , $current_action=='home' && !strpos($_SERVER['PATH_INFO'], "action,forum.html") ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
// Show the [forum] button.
echo '<li><a' , strpos($_SERVER['PATH_INFO'], "action,forum.html") ? ' class="current"' : '' , ' href="index.php/action,forum.html"><span>' , 'Forum' , '</span></a></li>';
Actually, this solution only works for the index page of the forum. Once you go into any post, it doesn't work anymore.
The best guess I have is to do it backwards. If path info is the home page, then set the home tab, otherwise set the forum tab.
Why not just set current_action==home. Then put forum in the current_action array? Thats the way all the other themes work. You seem to be going to the LONG way about it. lol
I'm noob when it comes to SMF Themes in the sense that I have no familiarity with how they work. I'm basically 'hacking' a solution here in an existing theme (Outline) because there hasn't been one posted to this thread. ;)
Can you please provide a code example of how "forum" gets put into the current_action array or point me to a theme that handles this correctly so I can look at how it's done?
Ha, I just found it when I clicked on the link in your sig (Read the TP Docs or Die). Thanks!
Meh, still the same problem once I actually navigate anywhere in the forum, the tab goes back to Home instead of Forum.
Solution was to follow the instructions in the docs for adding a button, and then doing this, as well:
// Show the [home] button.
echo '<li><a' , $current_action=='home' && !$_SERVER['PATH_INFO'] ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
// Show the [forum] button.
echo '<li><a' , $current_action == 'forum' || ($current_action=='home' && $_SERVER['PATH_INFO']) ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , 'Forum', '</span></a></li>';
Please post the whole template_menu() function so I can see what is going on.
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
// 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 (in_array($context['current_action'], array('search', 'admin', 'forum', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'forum')
$current_action = 'forum';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}
// Show the start of the tab section.
echo '
<div id="topmenu">
<ul>';
// Show the [home] button.
echo '<li><a' , $current_action=='home' && !$_SERVER['PATH_INFO'] ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
// Show the [forum] button.
echo '<li><a' , $current_action == 'forum' || ($current_action=='home' && $_SERVER['PATH_INFO']) ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , 'Forum', '</span></a></li>';
// How about the [search] button?
if ($context['allow_search'])
echo '<li><a' , $current_action=='search' ? ' class="current"' : '' , ' href="', $scripturl, '?action=search"><span>' , $txt[182] , '</span></a></li>';
// The [calendar]!
if ($context['allow_calendar'])
echo '<li><a' , $current_action=='calendar' ? ' class="current"' : '' , ' href="', $scripturl, '?action=calendar"><span>' , $txt['calendar24'] , '</span></a></li>';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<li><a' , $current_action=='admin' ? ' class="current"' : '' , ' href="', $scripturl, '?action=admin"><span>' , $txt[2] , '</span></a></li>';
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<li><a' , $current_action=='profile' ? ' class="current"' : '' , ' href="', $scripturl, '?action=profile"><span>' , $txt[79] , '</span></a></li>';
// Show the [help] button.
echo '<li><a' , $current_action=='help' ? ' class="current"' : '' , ' href="', $scripturl, '?action=help"><span>' , $txt[119] , '</span></a></li>';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<li><a' , $current_action=='pm' ? ' class="current"' : '' , ' href="', $scripturl, '?action=pm"><span>' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</span></a></li>';
// the [member] list button
if ($context['allow_memberlist'])
echo '<li><a ' , $current_action=='mlist' ? ' class="current"' : '' , ' href="', $scripturl, '?action=mlist"><span>' , $txt[331] , '</span></a></li>';
// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<li><a ' , $current_action=='login' ? ' class="current"' : '' , ' href="', $scripturl, '?action=login"><span>' , $txt[34] , '</span></a></li>';
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<li><a ' , $current_action=='register' ? ' class="current"' : '' , ' href="', $scripturl, '?action=register"><span>' , $txt[97] , '</span></a></li>';
// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '<li><a ' , $current_action=='logout' ? ' class="current"' : '' , 'href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '"><span>' , $txt[108] , '</span></a></li>';
echo '
</ul>
</div>';
}