-
AuthorPosts
-
railer Friend
railer
- Join date:
- October 2007
- Posts:
- 236
- Downloads:
- 102
- Uploads:
- 9
- Thanks:
- 17
- Thanked:
- 24 times in 1 posts
May 26, 2011 at 11:06 am #164467Hi Joomlart,
I want to have two different main horizontal menus for different sections of my site in JA Zeolite II. One will be for public visitors. The other will be for members after they log in. How can change the menu for each of the two areas of the site?
I read another post about removing JA Menu from a set of pages, but that is different.
I’m guessing that I’d need to make two different main menus & modules and then put some custom code into the mainnav.php file that can check to see whether a visitor is logged in or not and show them the proper menu
Maybe an if/else statement having to do with this line of code:
<?php if (($jamenu = $this->loadMenu())) $jamenu->genMenu (0); ?>.Can you please provide some code for this as I am not a programmer?
Thanks,
railerpritam Friendpritam
- Join date:
- April 2011
- Posts:
- 609
- Downloads:
- 0
- Uploads:
- 29
- Thanks:
- 11
- Thanked:
- 125 times in 113 posts
May 27, 2011 at 5:47 am #393111Hello,
To Show two main menus — one to visitors, another to logged-in members
First goto admin access -> menus -> Main menu -> Choose Your menu -> Access ->set to – Registered -> save -> JAT3 Clean Cache
and you can see Main menu which you set its working only for registered user.
This you can apply for other main menu items.
railer Friendrailer
- Join date:
- October 2007
- Posts:
- 236
- Downloads:
- 102
- Uploads:
- 9
- Thanks:
- 17
- Thanked:
- 24 times in 1 posts
May 27, 2011 at 12:34 pm #393198Thanks for your reply pritam —
I don’t think this will address my specific need, mainly because the regular public menu items will continue to display to the registered members, too, which is not what I want.
One possible solution that I think would work is to duplicate the template and then edit the code of the header.php file (JA Zeolite II) in each template to point to the correct mainmenu, for visitors or for members, since in that template the top menu is hardcoded into the ttemplate. And then I would assign each template to the proper pages. I’ve seen the specific fix in another post and will post here, but as I mentioned above in my initial post, it would be good to have some custom code instead of having to make duplicate templates.
Thanks,
railerthangnn1510 Friendthangnn1510
- Join date:
- October 2014
- Posts:
- 1608
- Downloads:
- 0
- Uploads:
- 80
- Thanks:
- 73
- Thanked:
- 278 times in 256 posts
May 31, 2011 at 4:16 am #393749Please give me the login information FTP/Admin account to your support ticket FKC-502-60002 http://support.joomlart.com. I’ll check for you.
railer Friendrailer
- Join date:
- October 2007
- Posts:
- 236
- Downloads:
- 102
- Uploads:
- 9
- Thanks:
- 17
- Thanked:
- 24 times in 1 posts
June 8, 2011 at 5:11 pm #395326Thanks thangnn1510,
Regarding my ticket #FKC-502-60002 below, I’ve found a solution provided by Don Lee by searching the forum.
Open file templates/ja_zeolite_ii/index.php
Find this code
Code:$ja_menutype = $tmplTools->getMenuType();
Don said to “Add before”, but I added the following after the above code line:
Code:
$user = & JFactory::getUser();
if ($user->get(‘guest’)) {
//not login
$tmplTools->setParam(‘menutype’, ‘MENU_ID_WHEN_NOT_LOGIN’);
} else {
//login
$tmplTools->setParam(‘menutype’, ‘MENU_ID_WHEN_LOGIN’);
}I replaced MENU_ID_WHEN_NOT_LOGIN with “publicmenu” (Name of my Public Menu”)
And I replaced MENU_ID_WHEN_LOGIN with “mainmenu”.It’s works!
Thanks,
railerrailer Friendrailer
- Join date:
- October 2007
- Posts:
- 236
- Downloads:
- 102
- Uploads:
- 9
- Thanks:
- 17
- Thanked:
- 24 times in 1 posts
June 9, 2011 at 10:43 pm #395621Looks like I spoke too soon. The above code does work, but it only shows the public menu on the frontpage, not on any of the other menu items in the public menu. The two menus I created are actually called Public Home (publichome) and Main Menu (mainmenu).
In the JA Zeolite ii template’s index.php file, there is some code that follows my new code which probably needs modifying to work properly. But I don’t know what that would be, precisely.
Here’s the full code for the main navigation block — including the new code I added:
//Main navigation
// ADDED FOLLOWING CODE TO DETERMINE IF USER IS LOGGED-IN MEMBER OR NOT
$user = & JFactory::getUser();
if ($user->get('guest')) {
//not login
$tmplTools->setParam('menutype', 'publichome');
} else {
//login
$tmplTools->setParam('menutype', 'mainmenu');
}// END OF NEW CODE
$ja_menutype = $tmplTools->getMenuType();
$jamenu = null;
if ($ja_menutype && $ja_menutype != 'none') {
$japarams = new JParameter('');
$japarams->set( 'menutype', $tmplTools->getParam('menutype', 'mainmenu') );
$japarams->set( 'menu_images_align', 'left' );
$japarams->set( 'menupath', $tmplTools->templateurl() .'/ja_menus');
$japarams->set('menu_images', 1); //0: not show image, 1: show image which set in menu item
$japarams->set('menu_background', 1); //0: image, 1: background
$japarams->set('mega-colwidth', 200); //Megamenu only: Default column width
$japarams->set('mega-style', 1); //Megamenu only: Menu style.
$jamenu = $tmplTools->loadMenu($japarams, $ja_menutype);
}
//End for main navigation
Any suggestions for code mods to get this to work would be appreciated. I’ve also submitted this to the support ticket and whatever solution comes up I will post here as well.
Thanks,
railer -
AuthorPosts
This topic contains 6 replies, has 3 voices, and was last updated by railer 13 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum