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

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

Previous topic - Next topic

khamseen

#501
I have been going mad trying to add three buttons I need for mods to the menu bar.

I have sat and read through the tutorials and I have searched through my .php files and simply cannot find ANY of the parts you're saying to look for.

Before someone says "What theme though?" I did in fact try it on a custom theme at first, when I couldn't find it I tried to follow the tutorials for the default themes to see if I could find them and I still couldn't.
"In hope we find despair and in despair we find truth." - Myself

Gary

Look for the template_menu function. It's always 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.

khamseen

Yeah, I found that. But that's all I find. Here, take a little look. This is the immediate area after "template_menu"

(From the default theme)


// Show the menu here, according to the menu sub template.
template_menu();

// Show the navigation tree.
theme_linktree();

// The main content should go here.
echo '
<div id="bodyarea">';
"In hope we find despair and in despair we find truth." - Myself

Gary

That's just the call to it. The actual function is near the bottom.

Ctrl+F for

function template_menu()
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.

khamseen

Ok, so I've found this part


function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

echo '
<div id="main_menu">
<ul class="clearfix">';

foreach ($context['menu_buttons'] as $act => $button)
{
echo '
<li id="button_', $act, '">
<a', $button['active_button'] ? ' class="active"' : '', ' title="', $act , '" href="', $button['href'], '">
<span', isset($button['is_last']) ? ' class="last"' : '', '>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
</a>
</li>';
}

echo '
</ul>
</div>';
}
"In hope we find despair and in despair we find truth." - Myself

Gary

You're using 2.0 in which case the method to add menu links would be in Subs.php read this for more info: http://www.smfthemes.org/index.php?topic=177.0
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.

khamseen

Aha, yes I knew I was using SMF 2.0 and the tutorial that I looked at which ironically enough linked to this topic said it was for SMF 2.0 strange.

But yes, now that I knew where to look and with the aide of that guide I have been able to add the two buttons I needed. They are hard coded but we only use English on our site so it's not too bad I suppose.

Thank you for the help. ;)
"In hope we find despair and in despair we find truth." - Myself

Gary

This guide is actually for 1.1, the template_menu was moved to the source files in 2.0 to make mods work across all themes at once, rather then just the default.
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.

midas

There are two mods that will allow you to add tabs to the menu bar.  Both work through Admin:

Custom Tabs

Menu Buttons

I use Menu Buttons but only because that's the one I found first.  Custom Tabs apparently gives more control over a custom tab's visibility to guests/members...

For Menu Buttons, I had to edit my customized index.template.php (simple copy and paste, not difficult).
Would be nice to get some traffic around here...

JournalXtra
121GuitarLessons.com

Gary

Yeah, but on 1.1 you would still need to edit the index.template.php of custom themes anyway, the Custom Tabs mod would work on all themes for it's 2.0 version though.
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.

khamseen

Awesome, I shall check them out. Thanks for the tips.
"In hope we find despair and in despair we find truth." - Myself

jensvanherck

#512
FIXED IT TY

Gary

I don't see any unlinked items in the template_menu...
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.

auss9960

#514
Quote from: JayBachatero on January 09, 2006, 09:01:28 AM
You want to add a second line of tabs?

-JayBachatero

I managed to add a second and a third line of buttons in BlueAce template like this:

// The NEW IMPROVED menu bar.

   $current_action = 'forum';
   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', 'beaches', 'home', 'about', 'etiquette', 'beaches', 'resorts', 'osbeaches', 'osresorts', 'blog', 'arcade', 'gallery', 'video', 'chat', 'downloads', 'contact', 'members', 'webmail')))
      $current_action = $context['current_action'];
   if ($context['current_action'] == 'search2')
      $current_action = 'search';
   if ($context['current_action'] == 'theme')
      $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
echo '

<br>
<div>
 
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber2" width="95%" height="12">
    <tr>
        <td colspan="2" id="menu" width="100%"><ul>
                                        <li><a><font color="#FF00FF">', 'Information', '</font></a></li>';
   // Show the [home] button.
   echo '
               <li', $current_action == 'home' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=home"' [nofollow];, $scripturl, '">', 'Home', '</a></li>';

   // Show the [about] button.
   echo '
               <li', $current_action == 'about' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=about"' [nofollow];, $scripturl, '">', 'About', '</a></li>';

   // Show the [etiquette] button.
   echo '
               <li', $current_action == 'etiquette' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=etiquette"' [nofollow];, $scripturl, '">', 'Etiquette', '</a></li>';

   // Show the [beaches] button.
   echo '
               <li', $current_action == 'beaches' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=beaches"' [nofollow];, $scripturl, '">', 'Aussie Beaches', '</a></li>';

   // Show the [resorts] button.
   echo '
               <li', $current_action == 'resorts' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=resorts"' [nofollow];, $scripturl, '">', 'Aussie Resorts', '</a></li>';

   // Show the [osbeaches] button.
   echo '
               <li', $current_action == 'osbeaches' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=osbeaches"' [nofollow];, $scripturl, '">', 'Overseas Beaches', '</a></li>';

   // Show the [osresorts] button.
   echo '
               <li', $current_action == 'osresorts' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=osresorts"' [nofollow];, $scripturl, '">', 'Overseas Resorts', '</a></li>';

   // Show the [rules] button.
   echo '
               <li', $current_action == 'rules' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=rules"' [nofollow];, $scripturl, '">', 'Our Rules', '</a></li></ul>

        </td>
    </tr>
</table>

<br></br>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber2" width="95%" height="12">
    <tr>
        <td colspan="2" id="menu" width="100%"><ul>
                                        <li><a><font color="#FF00FF">', 'The Forum', '</font></a></li>';
   // Show the [forum] button.
   echo '
               <li', $current_action == 'forum' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php"' [nofollow];, $scripturl, '">', 'Forum', '</a></li>';

   // Show the [blog] button.
   echo '
               <li', $current_action == 'blog' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=blog"' [nofollow];, $scripturl, '">', 'Aussie Blog', '</a></li>';

   // Show the [arcade] button.
   echo '
               <li', $current_action == 'arcade' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=arcade"' [nofollow];, $scripturl, '">', 'Games', '</a></li>';

   // Show the [gallery] button.
   echo '
               <li', $current_action == 'gallery' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=gallery"' [nofollow];, $scripturl, '">', 'Gallery', '</a></li>';

   // Show the [video] button.
   echo '
               <li', $current_action == 'video' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=video"' [nofollow];, $scripturl, '">', 'Video', '</a></li>';

   // Show the [chat] button.
   echo '
               <li', $current_action == 'chat' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=chat"' [nofollow];, $scripturl, '">', 'Chat Room', '</a></li>';

   // Show the [downloads] button.
   echo '
               <li', $current_action == 'downloads' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=downloads"' [nofollow];, $scripturl, '">', 'Downloads', '</a></li>';
   
   // The [calendar]!
   if ($context['allow_calendar'])
      echo '
               <li', $current_action == 'calendar' ? ' id="active"' : '', '><a href="', $scripturl, '?action=calendar">', 'Events', '</a></li>';

   // the [member] list button
   if ($context['allow_memberlist'])
      echo '
               <li', $current_action == 'members' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=members"' [nofollow];, $scripturl, '?action=members">' , 'Member List' , '</a></li>

   </ul>

        </td>
    </tr>
</table>
  <br></br>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber2" width="95%" height="12">
    <tr>
        <td colspan="2" id="menu" width="100%"><ul>
                                        <li><a><font color="#FF00FF">', 'My Panel', '</font></a></li>';
   
   // Show the [profile] button.
   echo '
               <li', $current_action == 'profile' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=profile"' [nofollow];, $scripturl, '">', 'My Profile', '</a></li>';

        // Go to PM center... [pm]
   if ($context['user']['is_logged'] && $context['allow_pm'])
      echo '
               <li', $current_action == 'pm' ? ' id="active"' : '', '><a href="', $scripturl, '?action=pm">' , 'Message Bank', ' ', $context['user']['unread_messages'] > 0 ? '<blink>['. $context['user']['unread_messages'] . ']</blink>' : '' , '</a></li>';


   // Show the [webmail] button.
   echo '
               <li', $current_action == 'webmail' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=webmail"' [nofollow];, $scripturl, '">', 'Web Mail', '</a></li>';

   // Show the [contact] button.
   echo '
               <li', $current_action == 'contact' ? ' id="active"' : '', '><a href="http://aussienaturists.com/index.php?action=contact"' [nofollow];, $scripturl, '?action=contact">', 'Contact Us', '</a></li>';

   // Show the [help] button.
   echo '
               <li', $current_action == 'help' ? ' id="active"' : '', '><a href="', $scripturl, '?action=help">', $txt[119], '</a></li>';

   // How about the [search] button?
   if ($context['allow_search'])
      echo '
               <li', $current_action == 'search' ? ' id="active"' : '', '><a href="', $scripturl, '?action=search">', $txt[182], '</a></li>';

   // Is the user allowed to administrate at all? ([admin])
   if ($context['allow_admin'])
      echo '
               <li', $current_action == 'admin' ? ' id="active"' : '', '><a href="', $scripturl, '?action=admin">', $txt[2], '</a></li>';


   // If the user is a guest, show [login] and [register] buttons.
   if ($context['user']['is_guest'])
   {
      echo '
               <li', $current_action == 'login' ? ' id="active"' : '', '><a href="', $scripturl, '?action=login">', $txt[34], '</a></li>
               <li', $current_action == 'register' ? ' id="active"' : '', '><a href="http://aussienaturists.com/myforms/joinform.html"' [nofollow];, $scripturl, '?action=register">', $txt[97], '</a></li>';
   }
   // Otherwise, they might want to [logout]...
   else
      echo '
               <li', $current_action == 'logout' ? ' id="active"' : '', '><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt[108], '</a></li>';
   echo '</ul></ul>

        </td>
    </tr>
</table>

Splitting the menu buttons between tables works fine. I have tried various things to get the buttons to be centered in the middle, but failed on all counts. However, if someone can easily tell me how to make a new row of menu buttons appear ONLY for admins and 1 other usergroup I would be very happy. The examples I have seen so far have not been workable. If you could please respond to [removed per user request - Iris] I would be grateful, as I cannot seem to set this forum to notify me of replies. If you'd like to look at my menu solutions you can through http://aussienaturists.com [nofollow]

TeaTephi

#515
Ok I need to add three tabs
"chat", "bookmarks", and "gallery"
I tried to follow the direction for chat, and it almost worked only it said "help", but it was really chat.  So I changed the text string to $txt['chat'] = 'Chat'; and look what happened. 

The same thing happened when I tried to add a line in index.english
$txt[120] = 'Chat';
and I also put in index.template to point to the 120 string, I obviously don't know what I'm doing . . .

I'm confused can someone tell me what I'm doing wrong?
SMF 2.0.2 | TinyPortal 1.107 Veterans day theme Opera 11.50
Mods:Profile Comments.....AEVA Media 2.10.....Activity in profile.....join-reason....Bookmarks 2.3.....SA Chat    Beta 4-1 Rev43....Tapatalk SMF 2.0 RC4/RC5/Final Plugin    3.0.1.....SMFPacks Likes Lite Mod

Thank you guys for all your support and development that you do.  I love my forum, and am so thankful to have a place to ask my questions.  I do love SMF 2.0 it's smoother and all my members love it!

Gary

Dont change any of the current language strings. Use $txt['chat'].

Though if you're using one language you may as well just hard code it into the template, and bypass the whole language string thing.
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.

TeaTephi

It only works if I type this in (and I get two help buttons, where one is help the other chat)

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


If I type $txt['chat'] it doesn't do anything!  Isn't that weird?
SMF 2.0.2 | TinyPortal 1.107 Veterans day theme Opera 11.50
Mods:Profile Comments.....AEVA Media 2.10.....Activity in profile.....join-reason....Bookmarks 2.3.....SA Chat    Beta 4-1 Rev43....Tapatalk SMF 2.0 RC4/RC5/Final Plugin    3.0.1.....SMFPacks Likes Lite Mod

Thank you guys for all your support and development that you do.  I love my forum, and am so thankful to have a place to ask my questions.  I do love SMF 2.0 it's smoother and all my members love it!

Gary

Add

$txt['chat'] = 'Chat'; to Modifications.language.php then call it.

Or change ' , $txt[119] , ' to just plain Chat forcing it in without using a string.
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.

TeaTephi

I changed it to plain chat and it worked! Ahhh, much better.

Thanks!

Going to try my bookmark and gallery tab the same way. 
SMF 2.0.2 | TinyPortal 1.107 Veterans day theme Opera 11.50
Mods:Profile Comments.....AEVA Media 2.10.....Activity in profile.....join-reason....Bookmarks 2.3.....SA Chat    Beta 4-1 Rev43....Tapatalk SMF 2.0 RC4/RC5/Final Plugin    3.0.1.....SMFPacks Likes Lite Mod

Thank you guys for all your support and development that you do.  I love my forum, and am so thankful to have a place to ask my questions.  I do love SMF 2.0 it's smoother and all my members love it!

Advertisement: