TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 578
  • Total: 579
  • @rjen

Adding top tab...

Started by shadrach, August 31, 2009, 04:59:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shadrach

Well, the page that everyone is reffered to if they want to add a new tab or button is very bare bones, and doesn't really help that much. For adding a new tab, it gives this code
if($settings['TPortal_front_type']!='boardindex')
// Show the [forum] button.
echo ($current_action=='forum' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action=='forum' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=forum">'.$txt['tp-forum'].'</a>
</td>' , $current_action=='forum' ? '<td class="maintab_active_last">&nbsp;</td>' : '';



Now, I named the tab "irc" in the array. Is this the proper code fro adding the tab now?
if($settings['TPortal_front_type']!='boardindex')
// Show the [IRC] button.
echo ($current_action=='irc' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action=='irc' ? 'active_back' : 'back' , '">
<a href="http://widget.mibbit.com/?settings=f814a0a9c46644a98d2d68c3a411b613&server=webirc.gamesurge.net%3A6007&channel=%23invictus&noServerNotices=true&noServerMotd=true&autoConnect=true" target="_blank">'.$txt['IRC'].'</a>
</td>' , $current_action=='irc' ? '<td class="maintab_active_last">&nbsp;</td>' : '';

IchBin

Technically, if action=irc doesn't exist on your forum you don't need to add the irc bits everyone in that code. All you need is the link, and the text for your link. If you have not defined $txt['IRC'] in one of the language files, then you will most likely get an undefined index error. You can do one of two things. Add $txt['IRC'] = 'IRC'; to your Modification.english.php file (or other language files). OR, you can change it to just be the text you want. Remove this (including periods and quotes) '.$txt['IRC'].' and just replace it with IRC (no quotes, commas, or periods etc).

Other than that, your button code should be fine. Of course, this button code assumes only the default theme. All other themes will most likely have a different  button code.

shadrach

Ok, so this is the code I added:
if($settings['TPortal_front_type']!='boardindex')
// Show the [IRC] button.
echo ($current_action=='irc' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action=='irc' ? 'active_back' : 'back' , '">
<a href="http://widget.mibbit.com/?settings=f814a0a9c46644a98d2d68c3a411b613&server=webirc.gamesurge.net%3A6007&channel=%23invictus&noServerNotices=true&noServerMotd=true&autoConnect=true" target="_blank">IRC</a>
</td>' , $current_action=='irc' ? '<td class="maintab_active_last">&nbsp;</td>' : '';


And here is the result:


Any idea how I can remedy this? the link works as needed, just looks horrid, LOL.

G6Cad

If you copy the forum button code from the theme in use ( the one you want to add the button to ) you get the correct code for the tabs. seems like you are using the code from the default core them.

Copy the code from the theme, make the changes to that one instead and it will work  :up:

shadrach

Thanks, that worked perfectly!!

As a quick aside, is there a way to make it where only certain membergroups can see a certain tab?

JPDeni

Quoteis there a way to make it where only certain membergroups can see a certain tab?

Yes. It's easier to do it by whether they're an admin or a moderator, though.

This website is proudly hosted on Crocweb Cloud Website Hosting.