[1.1] How to add tabs to Core (NDT)?

Started by JayBachatero, December 31, 2005, 04:21:57 PM

Previous topic - Next topic

PFDWM

HUH?  Got the first part  up to
QuoteNow if the code doesn't work, it may be because you need to add the mainNav-main class to your style.css file. Just copy the other classes related to one of the other buttons and change the name and properties to do what you need.

IchBin™

Sorry, some times I assume people will understand my ramblings. :) If you look in the style.css file you'll notice that all the buttons have a class or 2 associated with them. Any button you put in the theme, will also need these classes. A class is just a list of properties that are applied to the button to make it look the way the designer intended. Let me see if I can just grab the classes from your site....

.main-navigation li.mainNav-home {
background:transparent url(images/menu_home.gif) no-repeat scroll 0pt -18px;
width:47px;
}


You'll need to the above code to this:
.main-navigation li.mainNav-main {
background:transparent url(images/pfd.gif) no-repeat scroll 0pt -18px;
width:47px;
}


Also, didn't realize this was a background image. You'll need to change the width to the width of your button. You'll need to make a button for this (pfd.gif in the code). If you can't, you'll need to ask the author.
IchBin™        TinyPortal

PFDWM

Ok way to complex for my basic basic html knowledge... I pm'd M3talc0re  hopefully he can help

IchBin™

Well, I gave you all the code. So just add it to the files, and get yourself a button made. You'll be good to go. :)
IchBin™        TinyPortal

PFDWM

Yeah but the button could be the hardest thing to match

I hope you know I really appreciate everything, If i could get the button I think I would try it

Sir_Trout

Thanks to JayBachatero and all of the the other SMF Heros!  I was able to add in a menu item for our new gallery with little trouble!  Just did some reading on the "How do you add custom tabs to the Core (default) theme menu? " and this tread and I had it working in no time.

Thank you!

A2xA

I tried to add it, and it worked...but weirdly.  I have already added another button, but this one is an external link so it wound up different.  The link is blue instead of black and a little too close to my forum button.  I am actually cool with the button being blue, but I don't like the button being too close to forum.  Could someone help me out.

Site: http://www.wiicharged.com

/ // Show the [Game Hubs] button...
      echo ($current_action == 'Game Hubs' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'Game Hubs' ? 'active_back' : 'back' , '">
               <a href="http://www.forum.wiicharged.com/chat/flashchat.php">Game Hubs</a>
            </td>' , $current_action == 'Game Hubs' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Online Video Game Battles Community that Supports Xbox 360, Wii, And PS3

PFDWM

Im not expert on this at all, but it looks like its not centered (the text that is)  I would try, <td valign="center"

Maybe that might help But like i said im super new

Gary

clrews, Can you post in code boxes the entire template_menu() function in index.template.php
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

A2xA

#389
Sure Thing!  Thanks for helping.


// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0">
<tr>';

// Show the [home] button.
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '">' , $txt[103] , '</a></td>';

// Show the [forum] button.
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=forum">Forum</a></td>';


// Show the [Game Hubs] button...
      echo ($current_action == 'Game Hubs' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'Game Hubs' ? 'active_back' : 'back' , '">
               <a href="http://www.forum.wiicharged.com/chat/flashchat.php">Game Hubs</a>
            </td>' , $current_action == 'Game Hubs' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



// Show the [help] button.
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=help">' , $txt[119] , '</a></td>';

// Show the [arcade] button.
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=arcade">' , $txt['arcade'] , '</a></td>';

// How about the [search] button?
if ($context['allow_search'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=search" onClick="return overlay(this, \'subcontent\',\'bottom\')">' , $txt[182] , '<img src="', $settings['images_url'], '/search_down.gif" width="10" height="10" /></a>
<!--Do not remove outer most DIV tag with id="subcontent"-->
<DIV id="subcontent" style="position:absolute; border: 2px solid #3d3d3d; background-color: white; width: 210px; padding: 2px; display:none">
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tr>
<td class="catbg" align="left" valign="middle" style="color:#ffffff;height:20px;line-height:16px;">Quick Search</td>
</tr>
<tr>
<td height="26" align="left" valign="middle" class="windowbg">
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
<input type="text" name="search" value="" style="width: 150px;" />&nbsp;
<input type="submit" name="submit" value="GO" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']['allow_search']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']['allow_search']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

if ($context['allow_search'])
echo '
</form></td>
</tr>
<tr>
<td height="20" align="center" valign="middle" class="windowbg"><a class="subNav-link" href="', $scripturl, '?action=search;advanced">Advanced Search</a></td>
</tr>
</table>
<div align="right" style="font-size:10px;"><a style="color:#000000;" href="#" onClick="overlayclose(\'subcontent\'); return false">[Close]</a></div>

</DIV>
</td>';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=admin">' , $txt[2] , '</a></td>';

// The [calendar]!
if ($context['allow_calendar'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a></td>';

// the [member] list button
if ($context['allow_memberlist'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a></td>';


// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=login">' , $txt[34] , '</a></td>';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=register">' , $txt[97] , '</a></td>';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a></td>';

// How about the [quick links] button?
if ($context['user']['is_logged'])
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="', $scripturl, '#quicklinks" onClick="return overlay(this, \'quicklinks\',\'bottom\')">Quick Links<img src="', $settings['images_url'], '/search_down.gif" width="10" height="10" /></a>
<!--Do not remove outer most DIV tag with id="quicklinks"-->
<DIV id="quicklinks" style="position:absolute; border: 2px solid #3d3d3d; background-color: white; width: 150px; padding: 2px; display:none">
<table width="100%" border="0" cellpadding="0" cellspacing="1">



haha at first i did <code> instead of []


Online Video Game Battles Community that Supports Xbox 360, Wii, And PS3

Gary

Use this instead

// "If only kids would play more video games about sharing" - Marge Simpson
echo '
<td align="center" valign="top"><img src="' . $settings['images_url'] . '/menu_devider.gif" width="31" height="28" alt="" /></td>
<td class="mainNav"><a href="http://www.forum.wiicharged.com/chat/flashchat.php">Game Hubs</a></td>';
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

A2xA

#391
:P Thanks!  Haha I like the Simpson's, It's so funny how homer is always beating up on bart.  Anyways thanks for the help, it's all fixed now.


Online Video Game Battles Community that Supports Xbox 360, Wii, And PS3

PFDWM

OK I got the button, lets see if it will work... Its not exact but we'll see

PFDWM

well its not going to happen... I thank you all for helping

SoundOfWhiteNoise

Hello! I am new and I wanted to know if I did it right with adding a tab menu, if you go look at my forum, hxxp:whitenoise.ownspace.org/forums [nonactive] and I add "Gallery" but it was connected to "Logout" button , so how do I split it ?

thanks!  :)

Gary

Can you post the template_menu() function in index.template.php in code tags.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

SoundOfWhiteNoise

// 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('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'gallery')))
      $current_action = $context['current_action'];
   if ($context['current_action'] == 'search2')
      $current_action = 'search';
   if ($context['current_action'] == 'gallery')
      $current_action = 'gallery';
   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">
            <tr>';

   // Show the [home] button.
   if (!empty($settings['pnpn_forum_button']))
   echo '
   <td class="maintab_off_first">&nbsp;</td>
      <td valign="top" class="maintab_off_back">
      <a href="', $settings['pnpn_forum_button'], '">' , $txt[103] , '</a>
      </td>
   <td class="maintab_off_last">&nbsp;</td>';

   if (!empty($settings['pnpn_forum_button']))
   {
   // Show the [home] button.
   echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '<td class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '">' , $txt['pnpn_forum_button_forum'] , '</a>
            </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';

   }
   else
   {
   // Show the [forum] button.
   echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '<td class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '">' , $txt[103] , '</a>
            </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';

   }
   // Show the [help] button.
   echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '<td class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
            </td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
            </td>' , $current_action == 'search' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
            </td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
            </td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=pm"><span style="white-space: nowrap;">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</span></a>
            </td>' , $current_action == 'pm' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';

     // Show the [gallery] button.
   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">Gallery</a>
            </td>' , $current_action == 'gallery' ? '<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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
            </td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';

   // the [member] list button
   if (!empty($settings['member_list_button']))
   {
   if($settings['member_list_button'])
   {
   if ($context['allow_memberlist'])
      echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '<td class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
            </td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
            </td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
            </td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $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 class="maintab_off_' . $first . '">&nbsp;</td>' , '
            <td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'off_back' , '">
               <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
            </td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';

   // The end of tab section.
   echo '
         </tr>
      </table>';

}


here it is and tell me what I missed or what ?

MavsFlash

hi i am new to coding php and ive tried all that it sais here but it does not work on my template i am currently using the 'BlueAce template can anyone help me, also with the integrated java chat mod the chat page is not on the menu/links bar at the top right hand side of the page

IchBin™

This topic is for adding buttons to the default core theme. To add a button to a custom theme you should seek help from the author of the theme.
IchBin™        TinyPortal

susubotol

#399
Nevermind. Thanks.

Advertisement: