主题主要链接Drupal6.x添加跨距和有用的ID
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了主题主要链接Drupal6.x添加跨距和有用的ID相关的知识,希望对你有一定的参考价值。
themes the primary links adding spans (useful for sliding doors technique) and nice ID's based on the link title rather than the standard ugly menu-851 classes etc.
/** * Adds spans and useful ID's to the primary links. * */ $output = ''; $output = '<ul'. drupal_attributes($attributes) .'>'; $i = 1; foreach ($links as $key => $link) { $class = ''; // Add first, last and active classes to the list of links to help out themers. if ($i == 1) { $class .= ' first'; } if ($i == $num_links) { $class .= ' last'; } if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))) { $class .= ' active'; } $output .= '<li id="'. $id .'"'; if ($class) { $output .= ' class="'. $class .'"'; } $output .= '>'; // Pass in $link as $options, they share the same keys. $link['title'] = '<span>'.$link['title'].'</span>'; $output .= l($link['title'], $link['href'], $link); } // Some links are actually not links, but we wrap these in <span> for adding title and class attributes $link['title'] = check_plain($link['title']); } $span_attributes = ''; $span_attributes = drupal_attributes($link['attributes']); } $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>'; } $i++; $output .= "</li> "; } $output .= '</ul>'; } return $output; }
以上是关于主题主要链接Drupal6.x添加跨距和有用的ID的主要内容,如果未能解决你的问题,请参考以下文章