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,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 606
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 362
  • Total: 362

Button text

Started by Rabain, October 04, 2007, 08:31:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rabain

This is the default theme I'm working with and at the start I had download in the array and replacing help in the button section I copied but there was no download or button at all on the menu.

I added Downloads (originally it was download but it could as easily have been anything else) to the $txt part mentioned above but it did nothing.  Only after updating the index.english.php did it work.

I've tried updating the array so that is uses tpmod;dl but it makes no difference, the button still gets no highlight graphic when clicked.

My code is now:

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


and

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


with the following in index.english.php:

$txt[999] = 'Downloads';


jacortina

As noted, you weren't supposed to add the 'Downloads' to anything, that was to replace what was in part of the code line as shown in the code lines provided. But using a language string is fine, too.

As also noted in above posts, the 'action taken is 'tpmod'. Appending the ';dl' simply gives an unnamed parameter to the URL 'command' line which can be used by the script to discern WHICH TP Module is to be run. But the action is NOT 'tpmod;dl'.

Try this:
if (in_array($context['current_action'], array('gallery','search', 'admin', 'calendar', 'profile', 'mlist', 'tpmod', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))
$current_action = $context['current_action'];


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


Haven't tested it, though.

Rabain

No joy, unfortunately.  Error screen attached.

Downloads was just a later addition.  As mentioned all I originally did was copy the Help button code and follow the instructions as outlined in the Docs here which state to just replace help with download (or whatever) in the array and button info section.


jacortina

I think i gave you one too many parentheses in that line. Try:
echo (($current_action == 'tpmod') && isset($_GET['dl']) || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '

Rabain

Same kind of error..just on line 686 now!

jacortina

Line 686 is in the next section. Plase tost that download section as it is now and the next 6-12 lines.

Rabain

Here's that whole section:

// Show the menu up top. Something like [home] [help] [profile] [logout]...
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('gallery','search', 'admin', 'calendar', 'profile', 'mlist', 'tpmod', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';

if (isset($_GET['dl']))
$current_action = 'dlmanager';

if (isset($_GET['board']) || isset($_GET['topic']))
$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 '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

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

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

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>
</td>' , $current_action == 'pm' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

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

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

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


// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The end of tab section.
echo '


jacortina

I can see right now that you missed the last part of the last line of the code.

Your download button section ends "? '<td"

Here is the section with fixed parantheses.


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


lebisol

Hello crew,
I belive that
if (isset($_GET['dl']))
$current_action = 'dlmanager';

is the cause here...commenting it out resolved the tab issue (after using lst post/code from Cortina on td fix) but I am not sure  about the action "action=dlmanager;dl" ...where is this called out?
Thanks!

IchBin

Its not action=dlmanager its action=tpmod;dl

This website is proudly hosted on Crocweb Cloud Website Hosting.