SimplePortal
Development => Feature Requests => Topic started by: rocknroller on November 25, 2011, 03:19:28 PM
-
Option to remove Main menu buttons from portal home page.
example:
- You can make custom pages, related to your activities and link them. Make custom menu eg. Contacts, About us, Forum.. etc.
Sometimes you do not want to have a forum in the foreground.
have that option it would be nice. :)
-
You can do it by editing your Subs.php. For example:
'home' => array(
'title' => $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
.
.
.
and so on
You can modify the 'show' lines, like so:
'show' => true,
to
'show' => false,
or
'show' => $current_action == 'forum',
I'm pretty sure the alternative would work as well, allowing you to keep all the links when you're on the forum, but not show them elsewhere.
So you could also modify the forum button's 'show' clause from:
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
to
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']) && $current_action = 'forum',
-
thank you Eliana :)
That is cool! but won't work for me.
:| I tried like this also:
'show' => ($current_action == 'forum') ? 'true': 'false',
and I added in the global $current_action I do not know whether it is necessary, but won't work.
-
My bad on the last bit of code, it should be this:
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']) && $current_action == 'forum',
And yours should be this:
'show' => ($current_action == 'forum') ? true: false,
But this code is superfluous. The $current_action == 'forum' statement will evaluate to true if true and false if false.
-
Maybe I was not clear enough :P
I want a forum button on (home page and SP pages), and only forum button.
I don't want other buttons(related to forum) to show on (home page and SP pages).
eg. Help, Profile, My messages, Members... etc.
;D
This code work for me:
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => ($context['current_action']) == 'forum',
'sub_buttons' => array(
),
),
but there is issue with other actions eg. action=help also make disappear help button. Can we make some kind of variable for which would know that user is on home page and portal pages.
Then use it example:
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => !$home_page OR !$sp_pages,
'sub_buttons' => array(
),
),
-
Ahh, now I understand what you want.
You will likely need to add in every action of the forum into the area of Subs.php with the $current_action definitions, like this:
if (isset($context['menu_buttons'][$context['current_action']]))
$current_action = $context['current_action'];
elseif ($context['current_action'] == 'search2')
$current_action = 'search';
elseif ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))
$current_action = 'login';
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';
You can find a complete list of SMF actions in the index.php file in your forum's root folder.
-
must be easier and aesthetic way :P
can I create php block and put it on pages I want and home page, then create variable eg.
$prem_buttons = 0;
and then somehow call it there ;D
eg.
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => $prem_buttons = 0,
'sub_buttons' => array(
),
),
:)
-
Try this:
Sources/Subs.php
$context['menu_buttons'] = $menu_buttons;
if (getShowInfo(0, '', '$php return ({$page} !== \'\' || \'{$portal}\' === \'1\');'))
foreach ($menu_buttons as $id => $button)
{
if (!in_array($id, array('home', 'forum', 'login', 'register', 'logout')))
unset($menu_buttons[$id]);
}
$context['menu_buttons'] = $menu_buttons;
-
yes, that works. :) Thank you.
Now it is look like a real portal :P I guess it can add custom buttons and array it there to appear only on portal and pages. that is great! You should consider adding this option in the official version.
-
I don't support what you say.
-
Marjorie, do you have a similar issue like what's been presented here? Or another problem?
-
Try this:
Sources/Subs.php
$context['menu_buttons'] = $menu_buttons;
if (getShowInfo(0, '', '$php return ({$page} !== \'\' || \'{$portal}\' === \'1\');'))
foreach ($menu_buttons as $id => $button)
{
if (!in_array($id, array('home', 'forum', 'login', 'register', 'logout')))
unset($menu_buttons[$id]);
}
$context['menu_buttons'] = $menu_buttons;
that is great but i found one fault, if you add button, appears on the forum too. that should only be on the home and pages. :|
-
I have the same problem as the OP... sorry to reopen a old topic, but I got the same question so I guess its better to use this one... if I need to create another topic please let me know
the code that [SiNaN] give is awsome but is it possible to have a smiliar code for the forum?
I tried to add 'show' => !isset($_GET['action']) || $_GET['action'] != 'forum', on the bottuns that I dont want to show on the forum page, and it works, but only on the forum front page, if I got to a board, topic, PM, etc... all the other bottons appear....
I want the portal with is bottons and the forum and all forum directorys with differente bottons... is it possible?
-
You can make custom pages, related to your activities and link them. Make custom menu eg. Contacts, About us, Forum.. etc (http://simpleportal.net/Smileys/SimplePortal/nervous-happy.gif) (http://1c.teobit.ru)