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: 271
  • Total: 271

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

Hi,

It's me again...

I wanted to add a button to the menu for Downloads but when I followed the instructions in the FAQ here I get no button at all.

Here's my code:

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


I've added download to the other line mentioned in the FAQ too:

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


If I switch the $txt['download'] back to $txt[119] (I copied the code for the Help button) I get a button called Help that goes to Downloads.

I take it the 119 is referencing something somewhere, is there another file I can update and use the number reference or is there something simple I'm missing?

jacortina

The $txt values get loaded in the language files (in the 'languages' folder under default and modified/enhanced with those under specific theme).

try putting 'Downloads' (including the single quotes) where you have $txt['download'] or $txt[119] (or whatever is there at the moment.

Rus

I've changed these in a couple places but dont remember exactly where.

Look for files in your template theme that have the word english in the file name, like:

modifications.english.php

Something like that, in a couple of those files you'll find line after line of variables like that and you can add your own or change the ones that are there.

Rabain

Thanks guys.

Okay, pasting in the 'Downloads' (or anything else for that matter) doesn't work.

Adding an entry in index.english.php and assigning a number to it does when I also update index.template.php with the same number. At least now there is a Downloads button.

Only problem now is the Downloads button doesn't get that surround graphic (the one that shows you which button your are currently on) in the menu when it's clicked.

Something else needs to be changed for that?

G6Cad

In the array line, you have to add downloads  Not just 'download', your missing the s


jacortina

Excuse me, but if you replaced:
<a href="', $scripturl, '?action=tpmod;dl">' , $txt['download'] , '</a>

With:
<a href="', $scripturl, '?action=tpmod;dl">' , 'Downloads' , '</a>

It definitely would have worked, as I use this construct.

Of course, this would, too:
<a href="', $scripturl, '?action=tpmod;dl">Downloads</a>

jacortina

Quote from: G6 on October 04, 2007, 09:11:01 PM
In the array line, you have to add downloads  Not just 'download', your missing the s

I'm not that familiar with this section of code, but is that true?

The 'action' being done isn't 'download' OR 'downloads'. As far as I can see, the 'action' being done is 'tpmod' (with a 'dl' parameter added for the type of module).

G6Cad

Hm, you might be correct again, i looked at one theme (the only theme i have the download button in the header) and in the array it say "downloads" but i dont know where the highligt for the actuall button is called from. if i remove the S from it, the button show the home tab as active when in the downloadsection

G6Cad

In the web2 theme it's made like this
$context['menubox'][]=array(
            'title' => $txt['mydownload'],
            'link' => $scripturl.'?action=tpmod;dl',
            'chosen' => 'tpmod;dl',


So the array should perhaps be 'tpmod;dl', instead  ???

jacortina

I assume that THAT particular theme does the highlight based on matching the URL line to the value in 'chosen'.

Now you're in theme territory and that's definitely outside my zone. ;)

This website is proudly hosted on Crocweb Cloud Website Hosting.