Drupal- How to place a “name” attribute anchor link in menu item

If you are trying to place a “name” attribute in menu hyperlink then this can be accomplished by declaring  a function in your template.php file as below-

<?php
function phptemplate_menu_item_link($item, $link_item) {
 // Convert anchors in path to proper fragment
 $path = explode('#', $link_item['path'], 2);
 $fragment = !empty($path[1]) ? $path[1] : NULL;
 $path = $path[0];
 return l(
 $item['title'],
 $path,
 !empty($item['description']) ? array('title' => $item['description']) : array(),
 !empty($item['query']) ? $item['query'] : NULL,
 $fragment,
 FALSE,
 FALSE
 );
}
Bookmark and Share
Both comments and pings are currently closed.

One Response to “Drupal- How to place a “name” attribute anchor link in menu item”

  1. UncleCode.Com – Technology Blog | How to place a “name” attribute anchor link in menu item in Drupal was a nice article, thanks for sharing this informative news. It is always good when you can’t solely be informed, but additionally be entertained! I’ll visit your blog often for the latest stuff.

n