TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 14, 2024, 06:45:18 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,188
  • Total Topics: 21,220
  • Online today: 161
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 38
  • Total: 39
  • @rjen

How to add a button to TPStyle theme

Started by g6cad, January 27, 2008, 07:02:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

G6Cad

Add a button to your TPStyle Theme, the example is for the gallery, so if you want to add another button, rename the gallery to what ever you want the button to be called and add the correct text and paths for your custom button.

For the index.template.php add this code.

Add this in the array
'gallery',

So it looks like this.
if (in_array($context['current_action'], array('search', 'admin', 'gallery', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))

The add this where you want the button to show.

// Show the [Gallery] button.
   echo ($current_action=='gallery' || $context['browser']['is_ie4']) ? '<td class="mirrortab_active_first">&nbsp;</td>' : '' , '
            <td valign="top" class="mirrortab_' , $current_action=='gallery' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '?action=gallery">' , $txt['smfgallery_menu']  , '</a>
            </td>' , $current_action=='gallery' ? '<td class="mirrortab_active_last">&nbsp;</td>' : '';


Also add this
if ($context['current_action'] == 'gallery')
      $current_action = 'gallery';


Right after this
if ($context['current_action'] == 'search2')
      $current_action = 'forum';


And finally add this

if($current_action == 'gallery')
      echo '<li><a class="tab1" href="'.$scripturl.'?action=gallery">Gallery</a></li>';
   else
      echo '<li><a class="tab2" href="'.$scripturl.'?action=gallery">Gallery</a></li>';


Right after this
if($current_action == 'forum')
      echo '<li><a class="tab1" href="'.$scripturl.'?action=forum">Forum</a></li>';
   else
      echo '<li><a class="tab2" href="'.$scripturl.'?action=forum">Forum</a></li>';


That brings in the gallery button both in the header and in the menu bar.