Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Anarchy on January 05, 2012, 07:11:02 AM

Title: Extra Button for Main Page
Post by: Anarchy on January 05, 2012, 07:11:02 AM
Hi guys on my main page I have wordpress and under /forum I have smf, I would like a user to be able to navigate back to main page from smf, and would like to add an extra button "Main Page" which will direct to wordpress, how can I do that? If it is with editing smf files, would this stay on the next upgrade?

Thanks,
Anarchy
Title: Re: Extra Button for Main Page
Post by: French on January 05, 2012, 07:25:44 AM
Graphics and Themes (http://www.simplemachines.org/community/index.php?topic=82003.0) go to How to add tabs to themes.
Title: Re: Extra Button for Main Page
Post by: Illori on January 05, 2012, 07:39:25 AM
How do I add buttons to SMF 2.0 (http://wiki.simplemachines.org/smf/How_do_I_add_buttons_to_SMF_2.0)

and yes if you use the package manager to upgrade your change will stay in place.

also this is not a graphics nor templates issue any longer in 2.0.
Title: Re: Extra Button for Main Page
Post by: Anarchy on January 06, 2012, 07:22:29 AM
I did it successfully for the English lang and current theme in Subs.php, but background of "Home" is highlighted with orange, I want this highlight to be valid or active for "Main Page" button, how can I accomplish this one?
Title: Re: Extra Button for Main Page
Post by: Illori on January 06, 2012, 07:27:55 AM
find // Figure out which action we are doing so we can set the active tab.
   // Default to home.

in that file and copy one of the elseif's and edit it to match what you put in your custom button.
Title: Re: Extra Button for Main Page
Post by: Anarchy on January 06, 2012, 07:51:42 AM
Errm .. sorry but I didnt quite get what you mean ... I copy pasted 'Home' button, changed it to my desired custom button, but only the home is highlighted, can you maybe give an example? Or give the exact code I should be looking for to modify?

Thanks
Title: Re: Extra Button for Main Page
Post by: Illori on January 06, 2012, 07:52:31 AM
can you post the code you added for your button?
Title: Re: Extra Button for Main Page
Post by: Anarchy on January 06, 2012, 08:01:20 AM
        // All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
        if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || ti$
        {
                $buttons = array(
                        'ana' => array(
                                'title' => 'Ana Sayfa',
                                'href' => 'http://www.hababam.biz',
                                'show' => true,
                                'sub_buttons' => array(
                                ),
                                'is_last' => $context['right_to_left'],
                        ),

                        'home' => array(
                                'title' => 'Forum',
                                'href' => $scripturl,
                                'show' => true,
                                'sub_buttons' => array(
                                ),
                //              'is_last' => $context['right_to_left'],
                        ),
                        'help' => array(
                                'title' => $txt['help'],
                                'href' => $scripturl . '?action=help',
                                'show' => true,
                                'sub_buttons' => array(
                                ),
                        ),


Ana Sayfa = My Custom Button
Forum = Home button
Title: Re: Extra Button for Main Page
Post by: Illori on January 06, 2012, 08:04:51 AM
that button cant be set as active as it is not an action that is part of smf, the reason the "home" button is orange is because it is the page the user is currently on.
Title: Re: Extra Button for Main Page
Post by: Kays on January 06, 2012, 08:18:19 AM
Hi, if you are showing that menu bar on the Ana Sayfa page.  Something to try.

In the page for Ana Sayfa, before SSI.php is included, add the following:


$_GET['action'] = 'ana';
Title: Re: Extra Button for Main Page
Post by: Anarchy on January 06, 2012, 08:30:14 AM
I thought home was specially highlighted because it is home :) but when I navigated to admin, search etc. I see that they are also highlated, all clear and Ana Sayfa is completely something else, wordpress ... I guess thats why it cant be highlighted, but no problem, the site will survive :) thanks a lot for the replies guys,

Anarchy




Title: Re: Extra Button for Main Page
Post by: Kays on January 06, 2012, 08:45:03 AM
Yes, that's because Home is the default button.

Are you showing the menu bar on the Ana Sayfa page? It is possible to highlight the button. I've done it before. Just forget how though. ::)
Title: Re: Extra Button for Main Page
Post by: Anarchy on January 06, 2012, 12:22:00 PM
No both are separate installations have no bridge or any other connection between, in this case I will put Ana Sayfa button the bottom I guess because doesnt look nice , or I will try other combinations :)