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,224
  • Total Topics: 21,352
  • Online today: 633
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 188
  • Total: 188

How to add an extra button

Started by g6cad, October 22, 2006, 08:46:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

G6Cad

basically in your index.template.php file (in the theme folder)

search for this:


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'];


its before all the buttons code if u cant find it via a search - or u could always do a partial search beginning with if (in_array($context['current_action'] so atleast it will get u to the correct line incase the code had been altered by a mod earlier.

To it add your Array text (shows as YOUR-ARRAY-TEXT but in reality it will be the action u are adding like arcade, or links etc)

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


In the above where it says YOUR-ARRAY-TEXT u will put your link action like if ur adding a gallery button then u can name it gallery

next look for this line:

   // Show the [help] button.

depending on the theme (since each theme may use different button codes) the button codes below will be something like this:


// 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>' : '';



you just have to copy that code and change all the instances of help in the code above to:


// Show the [YOUR-BUTTON-TEXT] button.
echo ($current_action == 'YOUR-ARRAY-TEXT' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'YOUR-ARRAY-TEXT' ? 'active_back' : 'back' , '">
<a href="YOUR-LINK-HERE">YOUR-BUTTON-TEXT</a>
</td>' , $current_action == 'YOUR-ARRAY-TEXT' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


then add this code just before the    // Show the [help] button.

replace in it:
YOUR-ARRAY-TEXT >> with the array you declared in the 1st code change

YOUR-BUTTON-TEXT the text you want your button to show

YOUR-LINK-HERE >> add the url you want associated with that button
-------------------------

this is for default template

for theme specific the procedure is the same but the code will differ slightly for each theme but dont be alarmed if the code is different, just study the code a bit to see how each button is declared and just copy the code for a single button and add it below one of the other button codes. If you cant do it at all even after using this doc, please post a topic i the support forums asking for help.

This website is proudly hosted on Crocweb Cloud Website Hosting.