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

Murdoc_LaCN

ok well my themes that im using is the standard SMF themes the Dark black and that doesn't have a template.php in it :S

but the default has lots of them in if anyone could point me here is the screenshot



JayBachatero

Your theme must have an index.template.php file.  Sure you looking at the right directory?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert


Gary

They're variations on the default, thus don't use their own index.template.php, just copy the defaults copy into that directory, or edit the defaults copy (but I'd personally recommend the former).

-ALM
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

hi thanks for that but can you still point to me which 1 must i Edit :D and i think i would like to keep it that was as we have 5 types of skins

so pretty plz could you point it out :O and what must i edit ... i really need your help

Gary

Regardless of how many themes you have, the file you edit will always be index.template.php. But in your case, some of those five themes might have their own copy of it so you'd need to edit all copies of index.template.php.

The first post explains what you need to do get your links working.

-ALM
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.

spacecabbage

Hello,

I administrate a forum for our World of Warcraft guild, and it uses SMF Gallery.  I have added a new tab called 'Characters' that links to a category within SMF Gallery.  I did this by copying and modifying the Gallery tab.

However, when a user clicks on the Characters tab the link works fine, but the Gallery tab highlights instead of the Characters tab.

Is there any way to get the Characters tab to highlight properly?

Here is the SMF Gallery code for the tab:

// Show the [gallery] button.
if ($context['allow_smfgallery_view'])
echo ($current_action=='gallery' || $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 == 'gallery' ? 'active_back' : 'off_back' , '">
<a href="', $scripturl, '?action=gallery">' , $txt['smfgallery_menu'] , '</a>
</td>' , $current_action == 'gallery' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';


Here is the custom code for the Characters tab:

// Show the [characters] button.
if ($context['allow_smfgallery_view'])
echo ($current_action=='characters' || $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 == 'characters' ? 'active_back' : 'off_back' , '">
<a href="', $scripturl, '?action=gallery;cat=5">' , $txt['characters'] , '</a>
</td>' , $current_action == 'characters' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '<td class="maintab_off_' . $last . '">&nbsp;</td>';


Any help would be greatly appreciated :)

Gary

That's because SMF still thinks it's the Gallery since you have the action=gallery;cat=5.

-ALM
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.


Green Beret

#329
EDIT***

I cant seem to get certain things to work using SSI unless the www. is in the URL, why is this?

snowforum

Hello

Im a rookie to the net nevermind coding.  I want to add one tab which links to an outside site.  Ive read the topic all the way through but im still stuck!  Ive managed to complete the 1. first method  but i cannot find the code anywhere for step 2.
Nearest code to it is;
// Show the [home] button.
   echo '
         <td class="main-navigation"><a href="', $scripturl, '">' , $txt[103] , '</a></td>';

Which is obviously wrong!  My forum is snowforum.co.uk

Any help would be much appreciated!

Thanks 
http://www.snowbreak.co.uk - UK Ski and Snowboard event specialists

http://www.snowforum.co.uk - Ski and Snowboard forum; resort reviews, equipment reviews, snow reports, travel/events, and much more!

IchBin™

Not all themes are the same, and to me it appears you are not using the default theme? $script = the base URL to your forum. So if your forum is snowforum.co.uk then the link you posted above would be translated to this.
<a href="http://snowforum.co.uk/index.php>Home</a>

If you want to point a link to somewhere else just change the code:
// Show the [home] button.
   echo '
         <td class="main-navigation"><a href="', $scripturl, '">' , $txt[103] , '</a></td>';


To something like this:
// Show the [Google] button.
   echo '
         <td class="main-navigation"><a href="http://www.google.com">Google</a></td>';
IchBin™        TinyPortal

snowforum

Thanks for quick reply, ive done this and it worked.  My home tab is now the link for my outside site, i think i would prefer this to remain the forum home though.  Im still stuck on how to add an extra tab.
Thanks
http://www.snowbreak.co.uk - UK Ski and Snowboard event specialists

http://www.snowforum.co.uk - Ski and Snowboard forum; resort reviews, equipment reviews, snow reports, travel/events, and much more!

IchBin™

Are you using the Core theme? Judging by the code you posted I'm thinking you are not.
IchBin™        TinyPortal

snowforum

Im not even sure of whether im using the core theme sorry.

I think this may be it;  Theme Settings - SlickPro: Graphite
http://www.snowbreak.co.uk - UK Ski and Snowboard event specialists

http://www.snowforum.co.uk - Ski and Snowboard forum; resort reviews, equipment reviews, snow reports, travel/events, and much more!

IchBin™

Well not having the theme download I would prefer that you seek help in the topic for that theme. Here's a link for you.
http://www.simplemachines.org/community/index.php?topic=108837.0
IchBin™        TinyPortal

surge1007

I found this tutorial and it seemed fairly easy as I am somewhat programmer literate.  However even after I made the changes nothing happened?  I uninstalled the gallery mod and reinstalled it.......with no luck.  Any Ideas about what I am doing wrong?

Thanks for any help you may be able to give me!
Surge

sasawawa

Hey, all, i just installed SMF links mod successfully.

Now i want to add a new tag " links " on my forum homepage.

I have an action "links".

I just added

if ($context['current_action'] == 'links')
$current_action = 'links';
after

if ($context['current_action'] == 'search2')
$current_action = 'search';
  in my forum index.template.php . i using default theme.

But i still can't see there is a tag "links' display on my homepage.

Below is my template_menu code :

// 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', 'managegames', 'arcadesettings', 'arcadecategory', '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('links','search', 'arcade', 'admin', 'calendar', 'profile', 'mlist','register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';

if ($context['current_action'] == 'links')
$current_action = 'links';
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" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

// 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] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

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

echo ($current_action == 'arcade' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'arcade' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=arcade">' , $txt['arcade'] , '</a>
</td>' , $current_action == 'arcade' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>' , $current_action == 'search' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>
</td>' , $current_action == 'pm' ? '<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 valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [links] button
if ($context['allow_view_smflinks'])
echo ($current_action == 'links' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'links' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=links">' , $txt['smflinks_menu'] , '</a>
</td>' , $current_action == 'links' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>' , $current_action == 'login' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $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 valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The end of tab section.
echo '
<td class="maintab_' , $last , '">&nbsp;</td>
</tr>
</table>';


Any help would be greatly appreciate . :'(

Another question :

How can i change the "arcade" tag to " games" ?

Thanks


sasawawa

Tried many times but failed . :'( :'(

Help me ,please

Gary

Is there a string $txt['smflinks_menu'] in Modifications.language.php file? If there isnt then add it in.

$txt['smflinks_menu'] = 'Links'; before the closing ?>

or just replace ' , $txt['smflinks_menu'] , ' with "Links" (without quites) and hard code it in.

For the arcade, you can pretty much do the same.

-ALM
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.

Advertisement: