News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

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

hoss021

if you want to see my comparison here are both of my websites....
this site I'm using, that I'm working on right now is hxxp:ww.strictlyscionized.com/forum/ [nonactive]

the other site I have, Enables the gallery to be used in an Iframe on sfm 1.1rc3, cpg 1408 I believe.... and that site is: hxxp:www.ground-zerocc.com/forum/ [nonactive] is it possible to use the gallery tab in the scion site similar to the ground zero site?

Zero Ziat

#241
SMF Version: 1.1.1
Okay, seems a moron like me can't do this.

I want to add a "Shop" button to the NavBar. (Theme: Aa New Damage)
I tried every other stuff I could.

Please, I request gracefully that you finish my pain.

Thanks in advanced, Zero

(lol dramatical)

By the way: http://ss13s.fakefall.com/forums [nofollow] is the website.

HELP ME PLEASE!
Yo.

cheesenub

I'm trying to change the current home link to say "forum" and then add a new home link that goes to the main part of my website with the default 1.1.1 SMF theme.

I've basically taken the code for the home link and switched it to forum, but when I try to make a home link, it still links to the forum.

I'll keep searching in this thread, but it seems I've done everything right. A little help please!

// Work out where we currently are.
$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', 'chat', 'homepage')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';

if ($context['current_action'] == 'homepage')
$current_action = 'homepage';

if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

// Begin SMFShop code
if ($context['current_action'] == 'shop')
$current_action = 'shop';
if (in_array($context['current_action'], array('shop_general', 'shop_items_add', 'shop_items_edit', 'shop_cat', 'shop_inventory', 'shop_restock', 'shop_usergroup')))
$current_action = 'admin';
// End SMFShop code

// 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 [homepage] button.
echo ($current_action=='homepage' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'homepage' ? 'active_back' : 'back' , '">
<a href="http://www.floodplane.net/">Homepage</a>
</td>' , $current_action == 'homepage' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

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

Zero Ziat

No one is helping, it is totally inutile. :(
Yo.

hoss021

cheesenub 

I think there is a command that you can use to selet the style or theme when you select the link...
kinda like how tiny portal allows you to swtch themes with a click, but I don't know the coding, cause I'm a still a noob on this...

and I agree with you zero,
but I don't know what everyone is doing, cause this is a busy forum as well....

cheesenub

Quote from: hoss021 on January 18, 2007, 03:58:40 PM
cheesenub 

I think there is a command that you can use to selet the style or theme when you select the link...
kinda like how tiny portal allows you to swtch themes with a click, but I don't know the coding, cause I'm a still a noob on this...

and I agree with you zero,
but I don't know what everyone is doing, cause this is a busy forum as well....

What does the command have to do with adding a Homepage link button?

Daniel15

cheesenub, the Themes/default/index.template.php file is only for the default theme. Make sure you're editing the file corresponding to the theme you're using.

QuoteI want to add a "Shop" button to the NavBar. (Theme: Aa New Damage)
I tried every other stuff I could.

Please, I request gracefully that you finish my pain.
Please see http://www.daniel15.com/forum/index.php/topic,223.0.html :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

cheesenub

#247
I've gotten the links to show up but the links don't go to the right place.

See here:
http://www.floodplane.net/floodboard

I switched the Home button to Forum, but the new Home link should go to the main part of the site, and then the Gallery button should go to http://www.floodplane.net/cpg.

I'm not the best at php or html, so detailed help would be appreciated.

The theme I'm using is Leviathan. I posted on the thread for that theme, but got pointed to this one.

Here's the code I have for Leviathan's index.template.php:

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

// add buttons here
$context['menubox'] = array();

/*
'title' - the string the link will have
'link' - the actual link
'chosen' - which "current_action" this button belongs to.
'memberonly' - show it JUST for members
'guestonly' - show it JUST for guests
'permission' - any permission you want to check before displaying the button

*/

// home button
$context['menubox'][]=array(
'title' => $txt[103],
'link' => $scripturl,
'chosen' => 'homepage',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// forum button
$context['menubox'][]=array(
'title' => $txt[100],
'link' => $scripturl,
'chosen' => '',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// profile button
$context['menubox'][]=array(
'title' => $txt[79],
'link' => $scripturl.'?action=profile',
'chosen' => 'profile',
'memberonly' => false,
'guestonly' => false,
'permission' => 'allow_edit_profile',
);

// PM button
$context['menubox'][]=array(
'title' => $txt['pm_short'] . ' '. ($context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : ''),
'link' => $scripturl.'?action=pm',
'chosen' => 'pm',
'memberonly' => true,
'guestonly' => false,
'permission' => 'allow_pm',
);

// calendar button
$context['menubox'][]=array(
'title' => $txt['calendar24'],
'link' => $scripturl.'?action=calendar',
'chosen' => 'calendar',
'memberonly' => false,
'guestonly' => false,
'permission' => 'allow_calendar',
);

// shop button
$context['menubox'][]=array(
'title' => $txt['shop'],
'link' => $scripturl.'?action=shop',
'chosen' => 'shop',
'memberonly' => true,
'guestonly' => false,
'permission' => '',
);

// gallery button
$context['menubox'][]=array(
'title' => $txt['gallery'],
'link' => $scripturl.'?action=gallery',
'chosen' => 'gallery',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);


// member button
$context['menubox'][]=array(
'title' => $txt[331],
'link' => $scripturl.'?action=mlist',
'chosen' => 'mlist',
'memberonly' => false,
'guestonly' => false,
'permission' => 'allow_memberlist',
);

// search button
$context['menubox'][]=array(
'title' => $txt[182],
'link' => $scripturl.'?action=search',
'chosen' => 'search',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// admin button.This one have permission check for admin as well
$context['menubox'][]=array(
'title' => $txt[2],
'link' => $scripturl.'?action=admin',
'chosen' => 'admin',
'memberonly' => false,
'guestonly' => false,
'permission' => 'allow_admin',
);

// help button
$context['menubox'][]=array(
'title' => $txt[119],
'link' => $scripturl.'?action=help',
'chosen' => 'help',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// login button - just for guests
$context['menubox'][]=array(
'title' => $txt[34],
'link' => $scripturl.'?action=login',
'chosen' => 'login',
'memberonly' => false,
'guestonly' => true,
'permission' => '',
);

// register button - just for guests
$context['menubox'][]=array(
'title' => $txt[97],
'link' => $scripturl.'?action=register',
'chosen' => 'register',
'memberonly' => false,
'guestonly' => true,
'permission' => '',
);

// logout button - just for members
$context['menubox'][]=array(
'title' => $txt[108],
'link' => $scripturl.'?action=logout;sesc='. $context['session_id'],
'chosen' => 'logout',
'memberonly' => true,
'guestonly' => false,
'permission' => '',
);

// now render it
template_menu_render();
}

cheesenub

I figured it out.

I seemed to have made it harder than it seemed.

When setting up my shop, I must have figured a lot of stuff differently and forgot that scripturl and actions weren't needed.

Anyway, just put in a hard link on the 'link' lines and that did the trick.

hoss021

Aight I fixed my problem DUE to a space in the code I was unable to view the form my error was at the current_action ==  'gallery' no spaces there... so just an fyi now that I feel dumb.... and it works on SMF 1.1.1

lindaf

Quote from: JayBachatero on December 31, 2005, 04:21:57 PM

2. In the same file

// 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>' : '';



hey for us dummies... when it says code like the above example with no instructions afterwards (ie find,etc) Do you just mean to add that code to the file?  Add it anywhere?


codenaught

It's just an example of the home button as explained directly above it:

QuoteThe next step is adding the link itself.  This is an example of the home menu.

In any case what you can do is copy the code for the home button and edit the copied version of it to suit your needs.
Dev Consultant
Former SMF Doc Coordinator

Daniel15

QuoteDo you just mean to add that code to the file?
You add it wherever you'd like the button to appear. For example, if you want it to appear before the "Forum" button, you'd search for the forum button, and add the code on top of it. If you want it to appear next to the Calendar (as I do for SMFShop), you'd paste it below the calendar button.
Does this help you? :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

maxanto

Menu Button Seperator question... ok I cant believe I am gonna say this but Jay's code for the outside link menu add on button looks nearly perfectly in IE6 its juust missing the seperator inbetween my calendar and the new killboard burtton, but when youlook at it in Firefox it shows the link above the menu and distors the rest of the menu that follows it. Can I get a slight change to the following code that will prevent this? Here is the naughty link that does not work well n firefox:


   // Show the [killboard] button
            echo ($current_action == 'killboard') ? '<td class="maintab_active_' . $first .    '">&nbsp;</td>' : '' , '
   <td valign="top" class="maintab_' , $current_action == 'killboard' ? 'active_back' : 'back' , '"><a href="http://starlightindustries.org/killboard [nofollow]">Killboard</a></td>' , $current_action == 'killboard' ? '<td class="maintab_active_' . $last .'">&nbsp;</td>' : '';

And here is a link to my website:

http://starlightindustries.org/smf [nofollow]

Open it in IE and firefox and you will see what I mean. I think I only need to add the seperator in to fix this problem? But I dont see it from comparing the other entries to that one, they are so different they comnfuse me.

BTW Jay - I still think you are a god among men =)

maxanto

oh dear god i actually figured it out on my own.. and here is the scarey part I only got 3.5 hours of sleep last night. Here is what I did:

// Show the [killboard] button
            echo ($current_action == 'killboard') ? '<td class="maintab_active_' . $first .    

'">&nbsp;</td>' : '' , '
   <td valign="top" class="maintab_' , $current_action == 'killboard' ? 'active_back' : 'back'

, '"><li><a href="http://starlightindustries.org/killboard [nofollow]">Killboard</a></li></td>' ,

$current_action == 'killboard' ? '<td class="maintab_active_' . $last .'">&nbsp;</td>' : '';

all I had to do was add the <li> and </li>'s to it properly, so I am guessing thats the code for a sperater =) NM my noob question see Jay I can learn after all!

Dr.WhO

iv added two tabs on the template

but see what happened !!  :'(

i think i have done it wrong



http://101med.com/index.php?option=com_smf&Itemid=41 [nofollow]

what shall i do  ???


Thank U  ;)

MinasC

i added a tab named "games" , it went alright , but it gets me nowhere (returns to the same page i was) !!! other than the code changes to index.template.php i haven't done anything else (such as create a "game" script) , should i ?

and what if i want the new tab to link to a new page that doesn't belong to my forum's structure (e.g. create a "google" tab to link to google by opening a new page) ? what changes do i have to do then ?

thnx a lot !!!

Daniel15

Quote from: Dr.WhO on February 13, 2007, 12:46:38 PM
iv added two tabs on the template

but see what happened !!  :'(

i think i have done it wrong



http://101med.com/index.php?option=com_smf&Itemid=41

what shall i do  ???


Thank U  ;)
Since you're using a custom theme, it's best to ask at the support topic for that theme ;)

Quote from: MinasC on February 23, 2007, 01:47:27 PM
i added a tab named "games" , it went alright , but it gets me nowhere (returns to the same page i was) !!! other than the code changes to index.template.php i haven't done anything else (such as create a "game" script) , should i ?
Where do you want it to go?

Quote
and what if i want the new tab to link to a new page that doesn't belong to my forum's structure (e.g. create a "google" tab to link to google by opening a new page) ? what changes do i have to do then ?
You'd need to change the link. The button itself looks like:

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

On this button, the link looks like:
<a href="', $scripturl, '?action=shop">SMFShop</a>

The $scripturl is the full URL to your forum's index.php page (eg. http://www.daniel15.com/forum/index.php). To link to an external page, just change the link, and remove the $scripturl:

<a href="http://www.google.com">Google</a>

Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

MinasC

as for the button linking to an external site ... thnx a lot , i'll try it tomorrow morning and tell you how it went !!!

as for the button linking to a page within my tp/smf forum ... that page coulb be showing e.g. a .swf (flash) file (i intend it to be my family tree in flash) !!! how do i make the button linking to that page called e.g. "family tree" , and how do i set up this page ?

MinasC

couldn't help myself trying it now , and it worked perfect !!! THNX MAN !!!

now i got the problem of too many buttons in my menu , so i was thinking , could it be that each button would act like a drop-down menu on mouse over , renealing multiple sub-options (sub-tabs , if i could say so) ?

Advertisement: