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
You can leave a response, or trackback from your own site.

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

  1. Lesli Pridham says:

    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.

Leave a Reply

Turn on pictures to see the captcha *