Search articles


Search in titles
Search in article texts

Docs Navigation





How to add a button to TPStyle theme?

Started by Xarcell, April 24, 2008, 04:40:13 PM

Previous topic - Next topic

Xarcell

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.



Doc Written By: G6