News:

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

Main Menu

Adding [Home] [Forum] item in Main Menu Navigation

Started by ledor, September 20, 2010, 12:59:29 AM

Previous topic - Next topic

ledor

I've installed the SMF 2.0 RC3(default theme, curve) on location "www.  buhaydubai.  net23.  net/ forum", and I have the front page on "www. buhaydubai. net23. net", I was able to add the [Home], [Forum] in the main menu navigation.

Here's the current config:

Home -> www. buhaydubai. net23. net
Forum -> www. buhaydubai. net23. net/forum

Now my problem is about the active(highlighted) menu item.
Problem 1: if I access my forum from "www. buhaydubai. net23. net" the front page is displayed and the active menu item is at [Home].
But when I access my forum from "www. buhaydubai. net23. net/forum" the active menu item is [Home] but the page displayed is the Board Index.

Problem 2: I've access my forum from "www. buhaydubai. net23. net" the front page is displayed and the active menu item is at [Home]. I click the [Forum] menu item and I was redirected to Forum's Board Index and the active menu item is [Forum]. But when I click any topic from board index, the active menu item was moved from [Forum] to [Home].

Problem 3: If the user log-in on the front page, after log in, the user will be re-direct to Board Index but the active menu item is still at [Home].

Now, want I want is to correct the active menu item. If I am on the forum board, topics, etc, the active menu item should be at [Forum] and if I am on the Front page(www. buhaydubai. net23. net) the active menu item should be at [Home].

And if possible, if the user log-in on the Front Page, the user should be re-directed to front page, not on the board index and if log in on Board Index, the user should be re-direct to Board Index.

Any advise, thanks in advance.
Note: You can use below user info to move around the forum:
user id: test_user
password: password

Kill Em All

For the menu problem, search will be your friend, this question has been brought up on several occasions. Hint, look in your Sources/Subs.php.

For the second problem are you using SSI for the login?


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

ledor

Thanks for the quick reply, I've already searched the forum but didn't hit the correct thread. All of the thread I've read is to add new action, I've added new action. As for my solution, I've already added action="forum", but when clicking any topic from the board index, the executed url doesn't have "action" that's why it was go back to default active menu [Home]. Any solution to that?

And for the second problem, I'm not using the SSI function to display the main menu, I call directly the template_menu() function.
Is it better to called the SSI function? Please advise.

Thanks in advance

Kill Em All



My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

ledor

#4
Thank you for your reply and I'm sorry for taking your time.

I've already done what the link is saying, actually, I followed that link to add the [Home] and [Forum] before posting this thread.

here is my subs.php:

            'home' => array(
                'title' => $txt['home'],
                'href' => 'http://www.buhaydubai.net23.net',
                'show' => true,
                'sub_buttons' => array(
                ),
                'is_last' => $context['right_to_left'],
                // 'target' => '_blank',
            ),

I've changed the below code from

                'href' => $scripturl,

to

                'href' => 'http://www.buhaydubai.net23.net',


And added below code:

'forum' => array(
'title' => $txt['forum'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),


But my problem is, the [Forum] menu item(tab) doesn't get actived(highlighted). So again I've searched the forum and found that i need to add action "forum". So i updated the [Forum] menu item as below:

'forum' => array(
'title' => $txt['forum'],
'href' => $scripturl . '?action=forum',
'show' => true,
'sub_buttons' => array(
),
),


I've managed to highlight the [Forum] menu item when I clicked it. But when clicking any topics from the board, the highlighted menu item became [Home].

And I'm guessing because of this code

$current_action = 'home';

located at the same function:

function setupMenuContext()


But changing "$current_action" to "forum" causing my [Home] menu item not to highlight.

Any idea on how to solved the highlighted menu item?

I'm still reading the SSI, thank you for that.

Kill Em All

Feel free to attach your Subs.php, I'll take a look at it.

And yeah, there is quite a handful of info to read up on SSI, its very customizable.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

ledor

#6
Attaching my Subs.php...

thanks in advance.

Note: Maybe others have no Main Menu on the their added tabs that's why there is no one encountered active menu item problem. Hope to help me on this. I'm thinking to add "?action='forum'" in every board links, topics, but don't know if that's the best idea.


SSI.php:
Question about "ssi_login()", is there anyway to change the layout(alignment) of the edit boxes, instead of Vertically align, can I change it to horizontal?

Kill Em All

What seems to be the problem with the highlighted? I just tried your site and it seems to be working fine.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

ledor

If you access the site from

http://www.buhaydubai.net23.net/


The highlighted menu item is [Home]. Then, select [Forum] menu item, the highlighted switched to [Forum]. Click any board, or topic, the highlighted menu item switched back to [Home].

Kill Em All



My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

ledor

#10
I haven't seen this one. I'll read this and let you know later. Thanks.


Edit:
At last, I've solved my problem. Thanks for that link although it doesn't directly solved my problem but was able to find a solution based on the discussion. Here's what I've done:
Instead of adding

$context['current_action'] = 'home'

to my index.php (homepage), I've added the

$_REQUEST['action'] = 'home';
$_GET['action'] = 'home';


Then, on Subs.php I've changed the default current action to forum:

// Default to home. >> changed from 'home' to 'forum'
$current_action = 'forum';


That solved my problem.

Thanks a lot KEA!!!

Kill Em All



My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Advertisement: