SimplePortal

Support => English Support => Topic started by: Oldiesmann on November 09, 2009, 01:08:41 AM

Title: Adding portal homepage to linktree
Post by: Oldiesmann on November 09, 2009, 01:08:41 AM
I'm sure this has been brought up before, but searching didn't turn up anything useful...

I just converted www.seniorsandfriends.org to SimplePortal after we found that the shoutbox in the other portal wasn't as flexible as what we wanted.

However, we are missing one minor feature - the first link in the linktree is always the forum. We want something like this:

Portal homepage: Seniors and Friends (linking to index.php)
Forum: Seniors and Friends (linking to portal homepage) > Forum (linking to forum) ...

How can I add this functionality in?
Title: Re: Adding portal homepage to linktree
Post by: Nathaniel on November 09, 2009, 02:12:05 AM
The edit below should do what you want.

Code: ("Find (Sources/Subs-Portal.php)") [Select]
    if ($modSettings['sp_portal_mode'] == 1)
        $context['linktree'][0] = array(
            'url' => $scripturl . '?action=forum',
            'name' => $context['forum_name'],
        );

This code will display the "Forum" part of the linktree, everywhere by default.
Code: ("Replace") [Select]
    if ($modSettings['sp_portal_mode'] == 1)
    {
        array_unshift($context['linktree'], array(
            'url' => $scripturl,
            'name' => $context['forum_name_html_safe']
        ));
       
        $context['linktree'][1] = array(
            'url' => $scripturl . '?action=forum',
            'name' => $txt['sp-forum'],
        );
    }

If you don't want to display the "Forum" link on the portal, then the code below will not display it there.
Code: [Select]
    global $board, $topic;
    if ($modSettings['sp_portal_mode'] == 1)
    {
        if (!empty($_REQUEST['action']) || !empty($board) || !empty($topic))
        {
            array_unshift($context['linktree'], array(
                'url' => $scripturl,
                'name' => $context['forum_name_html_safe'],
            ));
           
            $context['linktree'][1] = array(
                'url' => $scripturl . '?action=forum',
                'name' => $txt['sp-forum'],
            );
        }
        else
            $context['linktree'][0] = array(
                'url' => $scripturl,
                'name' => $context['forum_name_html_safe'],
            );
    }
Title: Re: Adding portal homepage to linktree
Post by: [SiNaN] on November 09, 2009, 05:06:51 AM
It used to be that way before 2.2 I believe. We changed the behavior because it isn't easy to get used to first item in the linktree linking to portal page rather than the board index.
Title: Re: Adding portal homepage to linktree
Post by: Oldiesmann on November 09, 2009, 01:17:59 PM
Thanks for the code. That did exactly what I wanted :)
Title: Re: Adding portal homepage to linktree
Post by: H on November 09, 2009, 03:26:02 PM
/me marks this as solved :P
Title: Re: Adding portal homepage to linktree
Post by: Mick. on November 12, 2009, 11:52:39 PM
Thank you, i was looking for this. ;D
Title: Re: Adding portal homepage to linktree
Post by: luciano on May 19, 2012, 01:21:07 PM
I know this is old and the topic is solved, but not for me, as it still does not work how I want it to...
with this, When I am on portal i get :
Mysite->forum
and for pages, I get: Mysite -> forum ->pagename

I want it more logic.. so i wrote this fix, let me know if there is a drawback:

- When I am on Portal, i want the main link only: Mysite
- When I am in forum, i want : Mysite -> forum -> and page where I am.
the "forum" being the link to the forum index

- When i create a page, I want : Mysite ->Pagename (and not Mysite->forum->Pagename

To fix this i did the following based on the code above:

Code: [Select]
if ($modSettings['sp_portal_mode'] == 1)
{
if($context['SPortal']['on_portal'] == 1 || isset($_REQUEST['page']))
{
$context['linktree'][0] = array(
'url' => $scripturl,
'name' => $context['forum_name_html_safe']
);

}
else
{
array_unshift($context['linktree'], array(
'url' => $scripturl,
'name' => $context['forum_name_html_safe']
));

$context['linktree'][1] = array(
'url' => $scripturl . '?action=forum',
'name' => $txt['sp-forum'],
);

}
}
Now it seems to work as expected..
Luc
SimplePortal 2.3.8 © 2008-2024, SimplePortal