Make Menu Item non-clickable SOLVED

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Make Menu Item non-clickable SOLVED

Post by djohnson1215 » Fri Oct 16, 2009 6:03 pm

Hello All,

I have a general question - not sure this is the right forum but here goes.

I have often wondered if there is a way or technique that would make Joomla generated menu items non-clickable. What I mean to say is that some times, it is best to have a parent menu item that has lots of children menu items (menu level 0 with lots of menu level 1s) and have the parent show as part of the menu but non-clickable. The user would have the choice to click on the children menu items only.

I can do this if I use SWmenu, but I have not found a way with just the Joomla generated menus.

Any thoughts?
Last edited by djohnson1215 on Mon Oct 19, 2009 3:26 pm, edited 1 time in total.
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 28193
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Make Menu Item non-clickable

Post by imanickam » Fri Oct 16, 2009 6:11 pm

In the Joomla! generated menu, you can make the parent menu item to be of the type External Link and do not provide any link for that menu item. Then it will become non-clickable.
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator
Former Joomla! Translations Coordination Team Lead
Eegan - Support the poor and underprivileged

jeffchannell
Joomla! Ace
Joomla! Ace
Posts: 1964
Joined: Tue Jun 09, 2009 2:21 am
Location: WV
Contact:

Re: Make Menu Item non-clickable

Post by jeffchannell » Fri Oct 16, 2009 6:11 pm

Make the parent an external link to #

Still "clickable" but goes nowhere.
http://jeffchannell.com - Joomla Extensions & Support
http://biziant.com - Open Joomla Firewall/IDS
Unsolicited private messages/emails = hire me to fix your problem.
καλλιστι

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable

Post by djohnson1215 » Fri Oct 16, 2009 6:21 pm

jeffchannell and imanickam,

Great replies.

Jeff, as I was writing my question, I wondered if your suggestion would work.

I even though of making an article whose alias was #, but I am guessing Joomla will disallow this character.

Tks again for your replies.
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable

Post by raulbcordoba » Fri Oct 16, 2009 6:30 pm

Also making it as a separator and styling it into the CSS as a link, that should work too.

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable

Post by djohnson1215 » Fri Oct 16, 2009 6:47 pm

raulbcordoba,

That is an intriguing method. I see where you are going with this idea, but not sure how to implement it in Joomla. Do you have an example site I could see to check it out, or perhaps you could be a bit more verbose in your explanation.
:-)
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable

Post by raulbcordoba » Sat Oct 17, 2009 2:17 pm

Hi,

I have used this method few times in template development and works ok too.

When you create a menu item you can choose the type, sure thing, and if you go down on the list you'll see "Separator" this is almost like the "external link" but withouth link so you have a dummy menu item that does nothing so... what to do with it?

For dropdown menus, you can make the parent items like that if you don't really need them to have content when clickin on so lets say you just use them as a gateway to reach submenuitems, makes sense?

The difference when you create a "separator" menu item is that the output code is a bit different from normal links so you'll have to take care of CSS to make them look as if they were links...

This is a standard menu item:

Code: Select all

<li class="itemX"><a href="#"><span>Label</span></a></li>
Then you have with the separator:

Code: Select all

<li class="itemX"><span class="separator"><span>Label</span></span></li>
So you need to CSS both <li><a> and <li><span class="separator"> the same so they have the same style.

Hope this help

...

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable

Post by djohnson1215 » Mon Oct 19, 2009 3:25 pm

raulbcordoba,

Fantastic. Great post. I always wondered about the "Separator" menu type. Appreciate your verbose explanation.

Tks to jeffchannell and imanickam for their contribution.

Case closed :-)
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable - FOLLOW UP QUESTION

Post by djohnson1215 » Thu Nov 05, 2009 7:17 pm

Hi All,

Got one more follow up question about menu items.

In some cases, I would like to "hide" the home menu item. I just don't want it to show. Instead, I would like to have a HOME link somewhere else on the page such as header top_right.

The problem I run into is that Joomla needs a default menu and menu item. If that default menu item is the home page (frontpage), then I can not disable that menu item.

Now, I could create a new menu and position it in the top_right of the header. And I could make this new menu the default menu. And I could make the HOME link the default menu item. But that is lots of work. I would rather just create some <a tags in the header.

Is there another way around this challenge?
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable SOLVED

Post by raulbcordoba » Thu Nov 05, 2009 8:12 pm

I think it will be the best option as you'll be able to manage the menu items in an easy way and through admin instead of hardcoding them into the template or inside a module?

In my case I'd take that way.

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable SOLVED

Post by djohnson1215 » Thu Nov 05, 2009 9:56 pm

raulbcordoba,

I think I just thought of an easier way.

If I create another menu and make it the default. Then assign the home page menu item to it and make it default. NOW FOR THE TRICK. If I publish this new menu to a position that does not exist, that menu will never appear on the page, but the default condition should still apply.

I think that will work?????
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable SOLVED

Post by djohnson1215 » Thu Nov 05, 2009 10:13 pm

YEP, that did it. Very cool trick.

Steps to hide HOME PAGE menu item

0) add position in templateDetails.xml file. The position name should not be called in the index.php file. Instead, the position is an 'orphan' position.
1) create new menu.
2) add new menu item to newly created menu
2a) assign frontpage content to newly created menu item.
3) define new menu and new menu item as 'DEFAULT'.
4) add link to domain somewhere on page (footer, header, side column, etc.)

Now, when typing in the domain in a browser, the visitor goes to the home page. All top navs go to interior pages. Hard coded home page link goes to home page.
:-)
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable SOLVED

Post by raulbcordoba » Fri Nov 06, 2009 2:30 pm

Cool,

It can be a dirty trick but if it works then it's a good solution.

There is always a way in Joomla! :P

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable SOLVED

Post by djohnson1215 » Fri Nov 06, 2009 5:14 pm

raulbcordoba, What is 'dirty' about it.

I see more and more websites with out a "HOME" menu item in the primary menu. These sites have a "HOME" link either in the top right/footer/ or somewhere else. And most internet savvy people now know to click on the logo to go to the home page. So having a "HOME" link item detracts from a site's conversion funnel.

I have been trying to solve this kind of problem with Joomla for several month (on various projects). Now, I finally figured out a way and it seems to work well.

Did you mean "dirty" in jest? :-)

just my opinion here.
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable SOLVED

Post by raulbcordoba » Fri Nov 06, 2009 8:35 pm

Oh, don't missunderstand my words.

With dirty I meant "more hard" to do than usual things.

It just makes you think on how to use Joomla!, nothing more ;)

djohnson1215
Joomla! Explorer
Joomla! Explorer
Posts: 370
Joined: Fri Jun 13, 2008 7:49 pm
Location: Escondido, CA 92026
Contact:

Re: Make Menu Item non-clickable SOLVED

Post by djohnson1215 » Fri Nov 06, 2009 11:08 pm

One of these days, I would like to see a thread devoted to all the little tricks and tips for Joomla. May be I will start one. :laugh:
D. Johnson
Technology is our advantage;
performance our passion

http://www.positionresearch.com

thinksabin
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Mon Aug 24, 2009 9:19 am
Location: kathmandu, Nepal

Re: Make Menu Item non-clickable

Post by thinksabin » Sat Nov 07, 2009 6:29 pm

imanickam wrote:In the Joomla! generated menu, you can make the parent menu item to be of the type External Link and do not provide any link for that menu item. Then it will become non-clickable.
hi,
i have done this. the parent menu item is still clickable but when i click it...the page refreshes...
the problem is also that the sub menu-items of that parent menu are also not working..when i click the sub menu-item is shows 404 error article not found....how 2 solve this

thanks

User avatar
raulbcordoba
Joomla! Explorer
Joomla! Explorer
Posts: 299
Joined: Mon Aug 28, 2006 5:32 pm

Re: Make Menu Item non-clickable SOLVED

Post by raulbcordoba » Mon Nov 09, 2009 8:25 am

For the "clickable" issue you can refer to my first post where I tell to use a "separator" menu item type instead of "external link".

If you getting 404 errors then you you may check your menu routes/url or perhaps any SEF addons you're using?

Riverside
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 213
Joined: Mon Nov 05, 2007 8:54 pm

Re: Make Menu Item non-clickable

Post by Riverside » Wed Nov 17, 2010 6:59 pm

raulbcordoba wrote:Hi,

I have used this method few times in template development and works ok too.

When you create a menu item you can choose the type, sure thing, and if you go down on the list you'll see "Separator" this is almost like the "external link" but withouth link so you have a dummy menu item that does nothing so... what to do with it?

For dropdown menus, you can make the parent items like that if you don't really need them to have content when clickin on so lets say you just use them as a gateway to reach submenuitems, makes sense?

The difference when you create a "separator" menu item is that the output code is a bit different from normal links so you'll have to take care of CSS to make them look as if they were links...

This is a standard menu item:

Code: Select all

<li class="itemX"><a href="#"><span>Label</span></a></li>
Then you have with the separator:

Code: Select all

<li class="itemX"><span class="separator"><span>Label</span></span></li>
So you need to CSS both <li><a> and <li><span class="separator"> the same so they have the same style.

Hope this help

...
Thought this was worth quoting so it all shows up more recently in the thread.

Interestingly, I didn't have to mess at all with CSS. Simply creating the separator worked perfectly, though that may have had something to do with my template being produced in Artisteer to begin with. Perhaps the CSS is already set up as needed for me?

In any case, this works perfectly. I never bothered to play with the separator before. I always assumed (apparently mistakenly) that all it would do is create a line or something like that between buttons.
Don't let the number of stars fool ya! I spend most of my time in the "real world" working with and troubleshooting Joomla and the many extensions for it.

claudzone
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jun 27, 2016 9:05 am

Re: Make Menu Item non-clickable

Post by claudzone » Mon Jun 27, 2016 9:17 am

raulbcordoba wrote:Hi,

I have used this method few times in template development and works ok too.

When you create a menu item you can choose the type, sure thing, and if you go down on the list you'll see "Separator" this is almost like the "external link" but withouth link so you have a dummy menu item that does nothing so... what to do with it?

For dropdown menus, you can make the parent items like that if you don't really need them to have content when clickin on so lets say you just use them as a gateway to reach submenuitems, makes sense?

The difference when you create a "separator" menu item is that the output code is a bit different from normal links so you'll have to take care of CSS to make them look as if they were links...

This is a standard menu item:

Code: Select all

<li class="itemX"><a href="#"><span>Label</span></a></li>
Then you have with the separator:

Code: Select all

<li class="itemX"><span class="separator"><span>Label</span></span></li>
So you need to CSS both <li><a> and <li><span class="separator"> the same so they have the same style.

Hope this help

...
Hi,

I tried to put them both in Link CSS Style field, but it didn't work.

Where am I going to put in this code?

This is a standard menu item:

Code: Select all

<li class="itemX"><a href="#"><span>Label</span></a></li>
and this one?
Then you have with the separator:

Code: Select all

<li class="itemX"><span class="separator"><span>Label</span></span></li>
Thank you.


Locked

Return to “Templates for Joomla! 1.5”