Saturday, May 7, 2011

Put a pipe symbol in between primary link

1.Pu this code in the template.php file of your theme folder
2.Check the class of primary links in the page.tpl or page-front.tpl matches with class condition check indie this function if this function doesn't work

function youthemename_links($links, $attributes = array('class' => 'links')) {
$output = '';
// Change the way primary links are rendered
if($attributes['class'] == 'links primary-links') {
$linklist = array();
foreach ((array)$links as $key => $link) {
$linklist[] = l($link['title'], $link['href'], $link);
}
// Return the links joined by a '|' character
return join(' | ', $linklist);
}
// Normal theming continued below:

if (count($links) > 0) {
$output = '<ul'. drupal_attributes($attributes) .'>';

$num_links = count($links);
$i = 1;

foreach ($links as $key => $link) {
$class = $key;

// 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'] == '' && drupal_is_front_page()))) {
$class .= ' active';
}
$output .= '<li class="'. $class .'">';

if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .= l($link['title'], $link['href'], $link);
}
else if (!empty($link['title'])) {
// Some links are actually not links, but we wrap these in for adding title and class attributes
if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$span_attributes = '';
if (isset($link['attributes'])) {
$span_attributes = drupal_attributes($link['attributes']);
}
$output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
}

$i++;
$output .= "</li>\n";
}

$output .= '</ul>';
}

return $output;
}

No comments:

Post a Comment