By stephtek on
Is there a way to get the following code to display the link without spaces and capitals and add a dash in the space?
<?php
foreach($node->taxonomy as $term){
print '<a href="taxonomy/term/'.$term->name.'" rel="tag" title=""
class="taxonomy_term_'.$term->tid .'">'.$term->name.'</a>';
}
?>
Comments
huh?
Where is this code located?
To convert your term to all lowercase:
To replace spaces with dashes you can do this:
But that will not work with multiple spaces, so you would need a regular expression, like this:
There is a module for that :)
Check out http://drupal.org/project/termcase
Baris Wanschers (@BarisW)
Drupal specialist