English 中文(简体)
Joomla conditional menu item
原标题:

I d like to create a menu item in Joomla that points to one article when the user is logged out, and a different article when the user is logged in. I tried creating two menu items, and make them conditional by setting the access level. However, with that strategy, I can only make the logged-in item appear after login; I found no way to make the other menu item go away after login.

Any suggestions?

最佳回答

Modify your template with this code:

<?php $user =& JFactory::getUser();  if ($user->guest) : ?>
   <jdoc:include type="modules" name="menu-guest" style="xhtml" />
<?php else : ?>
   <jdoc:include type="modules" name="menu-registered" style="xhtml" />
<?php endif; ?>

Now set two different menus and 2 different menu modules and point them to the correct position: menu-registered and menu-guest.

问题回答

暂无回答




相关问题
cross platform issues in webpages

I am developing some basic html pages, i am setting colors of text usimg color code #e7eddf it seems fine in windows but seems different in mac. Can you explain me why its happening and also ...

How to create breadcumb for custom component in Joomla?

I have a custom component in which I want to have a breadcumb to help the user navigate the previous page visits. The basic feature in my component is to show our product releases. The workflow is: ...

Preloading images

i ve a navigation bar like the one below..for each it changes the background color on mouseover and mouseout and there is a lag to load those images which looks awful :( i wanna know how to preload ...

Joomla conditional menu item

I d like to create a menu item in Joomla that points to one article when the user is logged out, and a different article when the user is logged in. I tried creating two menu items, and make them ...

unable to connect to database on AWS

actually I have my website build with Joomla hosted on hostmonster but all Joomla website need a database support to run this database is on AWS configuration files need to be updated for that I ...

How can you test if you re on the homepage in Joomla?

I m working on a Joomla site, and I need the front page to look slightly different from the rest of the pages, but not enough to warrant the use of two themes (it s a pain to have to update two ...

How to get the current Joomla username?

I m trying to get the current Joomla username. I was able to get it by using $user =& JFactory::getUser(); echo $user->username; But now I ve installed Joomla on my local server and it doesn ...

热门标签