Last updated August 26, 2009. Created by nielsonm on April 25, 2006.
Edited by bekasu, add1sun, Dublin Drupaller. Log in to edit this page.
Note: See http://drupal.org/node/112761 for working with Drupal 5's primary links.
Drupal 6.9
Thanks to dman for a nudge in the right direction via his forum comment.
Copy and paste the theme_links function from theme.inc to your template.php file. change the name of the function to YOURTHEME_links where YOURTHEME is the name of your theme.
Add the following code snippet on the second line of the function, after the "$output=' ';"
<?php
// | delimiter added here.
if($attributes['class'] == 'links secondary-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);
?>
}As it is currently setup the secondary links will have the delimiter.
Next go to your page.tpl.php file and insert the following code into where you want the links to show up.
<?php
if(isset($secondary_links)){
print YOURTHEME_links($secondary_links, array('class' => 'links secondary-links'));
}
?>Drupal 4.7
Locate:
<?php
print theme('links', $primary_links)
?>To add a semi-colon as your deliminater change the code to:
<?php
print theme('links', $primary_links, ' : ')
?>Drupal 4.5 and 4.6
This snippet allows you to specify a delimiter for your primary or secondary links.
Thanks to bumathan for this snippet.
Primary links snippet:
<div id="navigation">
<?php if (is_array($primary_links)) : ?>
<ul id="main-nav">
<?php
$primary_link_delimiter = '|'; // Change this to what you want the links seperated by
$primary_delimiter = '</li>' . $primary_link_delimiter . '<li>';
print '<li>' . implode($primary_delimiter, $primary_links) . '</li>';
?>
</ul>
<?php endif; ?>
</div>Secondary links snippet:
<div id="navigation">
<?php if (is_array($secondary_links)) : ?>
<ul id="main-nav">
<?php
$secondary_link_delimiter = '|'; // Change this to what you want the links seperated by
$secondary_delimiter = '</li>' . $secondary_link_delimiter . '<li>';
print '</li>' . implode($secondary_delimiter, $secondary_links) . '</li>';
?>
</ul>
<?php endif; ?>
</div>Tips/tricks
Below is an example of the syntax used to change the delimiter to an image, instead of a character (thanks to pwolanin for this tip):
$primary_link_delimiter = '<img src="/path_to_image/myimage.gif">';
Comments
Update for Drupal 7?
Can someone update this for Drupal 7 please?