Clear cash (admin/config/development/performance)
Edit the HTML tag for "nolink" from to: at: admin/config/system/special_menu_items
Add the link to the menu of your choice using at: admin/structure/menu

$sub_menu = '';
  $main_title = check_plain(strtolower($element['#title']));
  if ($element['#below']) {

    // Prevent dropdown functions from being added to management menu as to not affect navbar module.
    if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
      $sub_menu = drupal_render($element['#below']);
    }

    else {
      // Add our own wrapper
      unset($element['#below']['#theme_wrappers']);
      $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
      $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
      $element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
	  $element['#localized_options']['attributes']['aria-expanded'] = 'false';
	  $element['#localized_options']['attributes']['aria-haspopup'] = 'true';

      // Check if this element is nested within another
      if ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] > 1)) {
        // Generate as dropdown submenu
        $element['#attributes']['class'][] = 'dropdown-submenu';
      }
      else {
        // Generate as standard dropdown
        $element['#attributes']['class'] = array('dropdown');
        $element['#localized_options']['html'] = TRUE;
        $element['#title'] .= ' <span class="caret"></span>';
      }

      // Set dropdown trigger element to # to prevent inadvertant page loading with submenu click
      $element['#localized_options']['attributes']['data-target'] = '#';
    }
  }
 // Issue #1896674 - On primary navigation menu, class 'active' is not set on active menu item.
 // @see http://drupal.org/node/1896674
 if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
   $element['#attributes']['class'][] = 'active';
   
 }
  if (<strong>strpos(url($element['#href']), 'nolink'</strong>)) {
	  echo '<pre>';print_r($element);
    $output = '<a href="#'.$main_title.'" datasrc="'.$main_title.'" class="dropdown-toggle hidden-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $element['#title'] . '</a>
			   <a href="#" datasrc="'.$main_title.'" class="dropdown-toggle hidden-lg hidden-md hidden-sm" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $element['#title'] . '</a>';
  } else {
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  }
  
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";

Comments

HunterT’s picture

Title: When I add <nolink> it takes me to a page that says "You don't have permission to access" » When I add nolink it takes me to a page that says "You don't have permission to access"

After

Smokenham’s picture

I am having the same problem with Drupal 7. Installed the module. Added to the url of my parent menu item.

The parent menu item is still a link and when clicked takes me to a page that says Access Forbidden

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

Error 403
localhost
12/04/11 21:18:10
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.

halloffame’s picture

+1 Having the same problem.

mastervissie’s picture

+1

camperqueenie’s picture

I'm getting:

Page not found
The requested page "/%3Cnolink%3E" could not be found.

I'm running Drupal 7.10 (Acquia Marina theme). Pathauto is enabled.

Patribus’s picture

same here

I get the error message: The path '' is either invalid or you do not have access to it.

trying to create a menu item in the main menu.

I hope someone can explain the problem!

verumaudio’s picture

Yup: The requested page "/%3Cnolink%3E" could not be found.

sagacity’s picture

I had the same problem and found out that the description of the module is wrong.

You have to choose "<separator>" instead of "separator" and "<nolink>" instead of "nolink" in the path field.

For me this fixed the problem (Drupal 7.12). Hope it helps!

Patribus’s picture

I'm having also the same problem, even changing the input "separator" to "<separator>" does not change the error!

wheatpenny’s picture

I'm getting the same error message as #5. It looks like the menu item is trying to link to a page at the path of "<nolink>" or "<separator>" instead of replacing those menu items with the desired output. This is on 7.12 using Pathauto and Menu Block.

liezie_D’s picture

I get the error "The requested page "/<nolink>" could not be found."
when i put <nolink> as path of my parent-menu.

McToth’s picture

I have the same problem... with Genesis theme

sbranstetter’s picture

+1 Same problem.

mattys’s picture

I get the same problem, but only when the is used in a drop down menu (nice menus)

it is working fine for a non drop down menu though...

looks like could be an issue using with nice menus

doesn't look like this issue is getting a lot of love!

mattys’s picture

I just uploaded latest dev version 7.x-1.x-dev (site is in development) and it seems to have sorted the problem.

f4o’s picture

#15 works for me to.

wooody’s picture

I change HTML tag for "nolink"

In module config and it's not work, still span with dev version.

Any help...

wooody’s picture

I changed it Maunally from the module code in special_menu_items.module

  if (in_array($variables['path'], array('<nolink>', '<separator>'))) {
    return '<a' . drupal_attributes($variables['options']['attributes']) . '>'
         . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text']))
         . '</a>';
  }
Anonymous’s picture

This is not a bug. This is a lack of explicit documentation on the project page and in the readme. However, the menu item edit form does have an explicit instruction.

Enter "<nolink>" to generate non-linkable item, enter "<separator>" to generate separator item.

Using <nolink> instead of nolink works. Documenting this on the project page and in the readme will go a long way toward preventing this from being an issue in the first place.

Anonymous’s picture

Status: Active » Closed (works as designed)

Setting this issue to "closed (works as designed" though I suggest the documentation be updated to more explicitly instruct the user how to correctly implement.

Delphine Lepers’s picture

Re-opening
Using does not work. The item leads to http://www.example.com/ < nolink > instead of not showing URL.
I am using nice menu too

mattsmith3’s picture

@ #21: same issue here. updating to dev fixes the issue in the menu system, but not on the outside of the site (theme layer). Works on Bartik.. I've just checked and this is a sub theme of omega.

halloffame’s picture

+1 on 6.x-1.6

Feckless’s picture

Status: Closed (works as designed) » Active

This issue still happens in my sandbox development site on my laptop. I'm trying to build a DRUPAL 7.21 site with a WAMP Apache/2.2.22 (Win32) server, PHP/5.4.3 and MYSQL version: 5.5.24 database. OS is XP Pro.

Using MegaMenu module. When I create a <nolink> menu item, the text/button displays properly. When I hover on the button, the Megamenu buttons appear correctly. However, if i click on the text button, meaning the <nolink> "parent," I get the following:

Forbidden
You don't have permission to access /MySite/ on this server.

I found this post on a GOOGLE search, but it looks like it's either forgotten, fixed? - or maybe I'm doing something wrong?

Please advise.

Thanks.

spanac’s picture

Several things to do:

  1. Clear cash (admin/config/development/performance)
  2. Edit the HTML tag for "nolink" from <span> to: <a href="#"> at: admin/config/system/special_menu_items
  3. Add the link to the menu of your choice using <nolink> at: admin/structure/menu

Also, follow this thread http://drupal.org/node/1867644 for mode ideas on what to change to HTML tag for "nolink" (at step 2).

Feckless’s picture

Thanks for the reply. I have not had a chance to test it out yet because I gave up on the MegaMenu setup and went with Nice Menus. Want to use Megas though, so I will work on this as soon as I get a time slot.

Thanks again.

Feckless’s picture

Issue summary: View changes

Problem in first post.

dbolser’s picture

Issue summary: View changes

Same problem in 7.x-2.0. I don't have admin/config/system/special_menu_items. I'm using "<nolink>". I get the error "The path '<nolink>' is either invalid or you do not have access to it.". This is superfish.

rooby’s picture

For those of you who are using some other non standard module to print menus, like nice menus, superfish, menu block etc. can you try without those modules enabled and if that makes it work, open an issue along the lines of "Special menu items don't work with superfish module" or whatever is relevant to your use case.

I suspect that a bunch of you have different causes for your problem and it is easier to solve them if each problem has its own issue.

hkovacs’s picture

Hi All,

This does not work with the superfish module. Please disable the superfish module and will save correctly.

dbolser’s picture

Works fine with superfish, you just need to clear caches and check permissions.

hardik jayeshbhai hihoriya’s picture

Issue summary: View changes

Clear cash (admin/config/development/performance)
Edit the HTML tag for "nolink" from to: at: admin/config/system/special_menu_items
Add the link to the menu of your choice using at: admin/structure/menu