Custom Tab

Started by Deprecated, September 17, 2008, 12:43:00 AM

Previous topic - Next topic

Stanimir

Simple Custom Tab   



Open YourTheme/index.template.php

Find
// Show the [home] button.
echo '<li', $current_action == 'home' ? ' class="chosen"' : '', '><a href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';




add after

// Show the [youtube.com] button.
         echo '<li', $current_action == 'youtube.com' ? ' class="chosen"' : '', '><a href=http://www.youtube.com/index.php ><span>Youtube</span></a>';






example:



Works only on Custom Themes ! default

have fun and cheers from bulgaria

Ehemm

I just uninstalled this mod but custom tab still appeared on the tab. how to remove it from the tab ? thanks :)

pooya

Anyone on how ot add more tabs in the default theme ?

jayman2

Quote from: apc73 on September 17, 2008, 08:15:34 AM
nice mod, would be better if there was a option to add another tab and have the name showing of the title of the tab when you put the mouse pointer over the tab
Thanks for the Great mod!  I was able to add a tab for my chat room.  But has this question been answered about adding another tab?  When I go to the "custom tab" page in admin, the fields are blank as though waiting to add another tab.  I don't want to attempt it without knowing for sure.  I don't want to mess up what I already have.

Thanks in advance.

PeeaichpeeBB


commonmind

I've tried to follow this thread the best I could, but after a late night with the kids I'm on the verge of mind-explosion.

I've already read the bits and pieces about this only being enabled through the default theme; however, I'm not sure I follow how to manually edit my custom theme's files in order to display this tab on my custom theme.

In other words, where do I begin? Works fine on the default theme (obviously).

JW21

#86
My SMF forum is version 1.1.7 and I use the imPulse theme. I have added that bit of code to that themes index.template.php page. The link does show but it shows up under the news header as a link. It doesn't stay in the menu list. Any help on the proper code for my theme? Any help would be greatly appreciated! And can it be coded to open up in a new window?

Filipina

And can it be coded to open up in a new window?

Love the mod thanks this is my question too... i tried to figure it out but could not :)

MaryLouW

I installed this mod for 1.1.7 tonight and it appears that the install went okay.  I can access the area where you give the button a name and a url. I did all of that, I enabled it so both guests and members can see it but the button does not show up on my menu bar with the other buttons. 

Where did I go wrong?

Smoky "Rider" Blue

if you use a custom theme, you myust edit the files for it ;)

idea for Depreciated:

make it adjustable, incase one wishes to add more than one tab.. would be a very good thing..  :)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

fire2104

Quote from: JW21 on January 06, 2009, 04:32:51 PM
My SMF forum is version 1.1.7 and I use the imPulse theme. I have added that bit of code to that themes index.template.php page. The link does show but it shows up under the news header as a link. It doesn't stay in the menu list. Any help on the proper code for my theme? Any help would be greatly appreciated! And can it be coded to open up in a new window?


mine does the same thing with different theme, only mine is UNDER the menu bar, anyway to adjust that?


here is how the coding for my theme looks it might help

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


so I assume the code for this script needs to be close to the above formatting to get the button inline with the rest of my menu?



on the open in new window thing there is an answer to that on I think page 3

AnnatarTheFair

For CUSTOM themes!

heres what I found, use at your own discretion and back up files!

for the index.template file, INSERT this in between say, "show home" and "show admin" etc -- in other words just IN between the blocks of code for the menu stuff:



// Show the [custom] tab.
   global $user_info, $modSettings;
   if ($user_info['is_guest'] ? !empty($modSettings['custom_tab_enable_guest_access']) : !empty($modSettings['custom_tab_enable_member_access']))
      echo ($current_action == 'custom' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '', '
            <td valign="top" class="maintab_', $current_action == 'custom' ? 'active_back' : 'back', '">
               <a href="', !empty($modSettings['custom_tab_execute_url']) ? $modSettings['custom_tab_execute_url'] : $scripturl, '">',
               !empty($modSettings['custom_tab_label']) ? $modSettings['custom_tab_label'] : $txt['custom_tab_label_default'], '</a>
            </td>' , $current_action == 'custom' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



All I did was gank this from the DEFAULT theme, which DOES allow this --now this doesn't seem to create a button for all, but it seemed to always give a link -- and on several themes a button WAS created!

Good luck, and I'll try next to see if I can use MORE than one of these ( and maybe just do a duplicate insert of the above! )

We'll see, but this was making me kookoo, and I know just bits of this coding, but really NEEDED this.

Like I said, back UP the original php !


w0lfman

 Everything was installed properly and the configuration of the button was enable for guest and users, but the button isnt being displayed.  I have the default forum with over 30 MODS currently installed.  Is it possible another MOD is preventing it from being displayed?

Smoky "Rider" Blue

i doubt it, but then you havent said which smf, what mods are installed or any errors in your log..

there is another button mod from bk and they both work together, as for multi buttons, just a little bit of code rearranging can do the trick. ;)

and really, when working a code into a custom theme, most the time, depending on how the theme is coded, the above might not work, best to look at both of the codes and read the xml file and try to mesh the code into each other..  8)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

steve51184

hey can you add the ability to be able to add more then 1 link to the menu as i was a little disappointed to find out you ca nonly add one :(

Joe N

Hi

I installed this mod. The index.template.php was failed so I added it manualy to the theme. I put my url in and my becuase it was for my SHOP, I called it SHOP. I added that but all I can see is the url for it. But that is in red. I am using the ds natural theme.

www.3smf.com/colmoreband

Joe
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


sAce

Quote from: Joe N on May 16, 2009, 10:27:09 AM
Hi

I installed this mod. The index.template.php was failed so I added it manualy to the theme. I put my url in and my becuase it was for my SHOP, I called it SHOP. I added that but all I can see is the url for it. But that is in red. I am using the ds natural theme.

www.3smf.com/colmoreband

Joe

u didnt edit index.template properly

Joe N

#97
Quote from: S-Ace on May 16, 2009, 10:47:16 AM
Quote from: Joe N on May 16, 2009, 10:27:09 AM
Hi

I installed this mod. The index.template.php was failed so I added it manualy to the theme. I put my url in and my becuase it was for my SHOP, I called it SHOP. I added that but all I can see is the url for it. But that is in red. I am using the ds natural theme.

www.3smf.com/colmoreband

Joe

u didnt edit index.template properly

It should be right. I just added the code before the search button like it said
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


EDSucation

Works great on my 1.1.9 forum [nofollow]!

EDSucation

I do agree with Smoky, I wish we could pick how many tabs we'd like to add, and maybe in what order to place them.

Advertisement: