News:

Wondering if this will always be free?  See why free is better.

Main Menu

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

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

Previous topic - Next topic

Gary

#360
You dont do the external part there. The URL would be a little lower with a <a href tag.

Quote from: ching on December 09, 2007, 12:27:04 PM
// Show the [Gallery] button.
                              echo '<li><a' , $current_action=='Gallery' ? ' class="current"' : '' , ' href="', $scripturl, '?action=Gallery"><span>' , Gallery , '</span></a></li>';

Have you tried using "gallery" without quotes instead of "Gallery" (notice the lowercase G) and also change

' , Gallery , ' to just plain Gallery (without the commas and apostrophes)
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.

Snow Wolf

Quick question:

I want to make a homepage button and make the home button a news button. I know how to make buttons and how to rename them, but how do I make it link to something out of the smf? I want the link to take the user to the main page; www.mythicsoftware.com which is just an html page I wrote.
www.MythicSoftware.com

Software for the Pagan community

Gary

If you wanna link to an external just change where the href goes to.

ie. instead of href="' , $scripturl , '?action=tcb"
you can link to href="http://babysimpson.co.uk"
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.

Snow Wolf

www.MythicSoftware.com

Software for the Pagan community

Snow Wolf

I think I hit a small problem. I wanted to rename "HOME" to "NEWS" in the menu bar. I edited the code to the following and it did not change:

if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'gallery', 'pm', 'forum', 'tpadmin', 'homePage', 'news')))


// Show the [news] button.
echo ($current_action=='news' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'news' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'news' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
if($settings['TPortal_front_type']!='boardindex')
www.MythicSoftware.com

Software for the Pagan community

Gary

You didnt need to change any hard coded references to the word "home" just change ' , $txt[103] , ' to ', $txt[102], '.

<a href="', $scripturl, '">' , $txt[103] , '</a>

technically determines what the HOME link is called.
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.

Snow Wolf

Thank you very much, works wonderfully. So what array is $txt pulling from? I just wanted to see the list.
www.MythicSoftware.com

Software for the Pagan community

Gary

$txt is used in all the language files. ($helptext in Help.language.php 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.

Murdoc_LaCN

lol hi Gazmanafc :P i think you are already sick of me LOL

   // Show the [SGS Servers] button.
   echo ($current_action == 'SGS Servers' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'SGS Servers' ? 'active_back' : 'back' , '">
               <a href="http://hl2stats.saix.net/hlstats.php?game=hl2mp">' , $txt[119] , '</a>
            </td>' , $current_action == 'SGS Servers' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


now that is the code the button works nice :D but now 1 prob lol



as you can see :P it named it Help instead of SGS Servers :O

what am i doing wrong :P

it is the help before logout

Gary

Change ' , $txt[119] , ' to SGS Servers instead.
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.

Murdoc_LaCN


arcardenas

Hi, I'm sorry, but I'm stuck and my brain has stopped working. I'm trying to add a link to the wiki part of my site which sits at the same level as the forum. I've edited index.template.php like so

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

// Show the [wiki] button.
echo '<td valign="top" class="maintab_back"><a href="../wiki">wiki</a></td>';
[/php]


neither the "_test" part I added to the home link nor the wiki part of the tab are showing up. I've no idea what I could be missing. Really appreciate the help :).

Gary

// Come on Wikipedia, load you unwieldy behemoth! -Sideshow Bob
echo ($current_action=='wiki' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'wiki' ? 'active_back' : 'back' , '">
<a href="URL TO WIKI">Wiki</a>
</td>' , $current_action == 'wiki' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Should do the trick.
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.

arcardenas

hehehe yeah, it's working now. Do the template changes take time to propagate to the index file if you are using DB Sessions?

Gary

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.

arcardenas


PFDWM

Well I tried this and all links went to the way top of page and the button i added didnt work... I am just going to quit and let sleeping dogs lie.... I obviously can't code... oh well... can't say I didnt try. :)  good reading though

IchBin™

You post your code and we can help PFDWM.
IchBin™        TinyPortal

PFDWM

#378
Quote
// 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', 'PFD' )))
      $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';

   // 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 '
         <ul class="main-navigation">';

   // Show the [home] button.
   echo ($current_action=='home' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-home"><a href="', $scripturl, '">' , $txt[103] , '</a></li>' , $current_action == 'home' ? '' : '';

   // Show the [help] button.
   echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-help"><a href="', $scripturl, '?action=help">' , $txt[119] , '</a></li>' , $current_action == 'help' ? '' : '';

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

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

   // Edit Profile... [profile]
   if ($context['allow_edit_profile'])
      echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-profile"><a href="', $scripturl, '?action=profile">' , $txt[79] , '</a></li>' , $current_action == 'profile' ? '' : '';

   // Go to PM center... [pm]
   if ($context['user']['is_logged'] && $context['allow_pm'])
      echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-messages"><a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a></li>' , $current_action == 'pm' ? '' : '';

   // The [calendar]!
   if ($context['allow_calendar'])
      echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-calendar"><a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a></li>' , $current_action == 'calendar' ? '' : '';

   // the [member] list button
   if ($context['allow_memberlist'])
      echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-members"><a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a></li>' , $current_action == 'mlist' ? '' : '';


   // If the user is a guest, show [login] button.
   if ($context['user']['is_guest'])
      echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-login"><a href="', $scripturl, '?action=login">' , $txt[34] , '</a></li>' , $current_action == 'login' ? '' : '';


   // If the user is a guest, also show [register] button.
   if ($context['user']['is_guest'])
      echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-register"><a href="', $scripturl, '?action=register">' , $txt[97] , '</a></li>' , $current_action == 'register' ? '' : '';


   // Otherwise, they might want to [logout]...
   if ($context['user']['is_logged'])
      echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-logout"><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a></li>' , $current_action == 'logout' ? '' : '';

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

}



I am adding 'PFD'  I would Like it to be 'PFD Home'  but I read a thread that it couldnt have a space.


Quote// Show the [PFD] button...
      echo ($current_action == 'PFD' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'PFD' ? 'active_back' : 'back' , '">
               <a href="http://www.pattersonfiredept.org">PFD</a>
            </td>' , $current_action == 'PFD' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Now i thought i put this in the right place but i guess i didn't  where exactly does it go?

Thank You!

IchBin™

Oh, right away do you see the problem? :) You're using a custom theme that doesn't use the same code as the default core theme. Remember you can just copy one of the other buttons you see in that code you posted, and then just change the necessary things that you need. You really should seek help from the theme author when you want a button in another theme as the code is almost always different. You should be able to use this for your button.

   // Show the [PFD Home] button.
   echo ($current_action=='home' || $context['browser']['is_ie4']) ? '' : '' , '
            <li class="mainNav-main"><a href="http://www.pattersonfiredept.org">PFD Home</a></li>' , $current_action == 'home' ? '' : '';


Now 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™        TinyPortal

Advertisement: