Hi,
in my special case, users are allowed to choose multiple values from a long, very long, vocabulary list.
When displaying the fields, each term is in its own line. Is there an easy way to make this list comma seperated?
Thanks for any help
rainer
Comments
Comment #1
mh86 commentedHi!
yes, if you want your own theming, you have to override the default in a template file.
Comment #2
korayal commentedanother possible solution;
http://drupal.org/node/167255
Comment #3
(not verified) commentedComment #4
blecheimer commentedoverride in template.php (Drupal 6, actual version of content taxonomy)
now, you will get a comma after every term.
To do not display the last comma => add this to your css file: (I am not a php coder- i don't know another way, but there is one)
Comment #5
abaddon commentedthis applies to latest drupal 6 as of today, ive just copied the function from the module and added the $last variable and used it in the return
p.s. handles not placing a comma for the 'last' element, this is a theme override in template.php, use it from your custom theme..
Comment #6
trevorjfitz commentedLooks great, seems great, great idea, but....I can't get it to work. Bah! Can the $last variable really used in this context?
Comment #7
trevorjfitz commentedOk, I realize now that my previous comment may not have made much sense.
If I print the code count($element['#node']->$element['#field_name']); I get 0's for every element. And when I print_r($element) I wonder how count could be useful, since it is one of everything.
I'm depressed I have spent so long on this issue, but it isn't an optional requirement for me. Ah the life of a developer.
Comment #8
summit commentedSubscribe and set do D6, which is where the last comments are about. How to get a bullit list of terms?
greetings, Martijn
Comment #9
trevorjfitz commentedWell, I officially have the lamest solution ever to this problem.
Step 1:
In the PHP from step 5, add a span with class "commaKiller"
Step 2:
Just before the end of the body tag in page.tpl.php, include the following code:
There you have it. It works!
Comment #10
abaddon commented@trevorjfitz - you are using this from template.php in the site's active frontend theme right? not in a module
last time i used this (when i posted it) it worked fine.. maybe content taxonomy changed something in its theme_ function..
$last is a boolean deciding if this is the last printed element, i dont remember why it looks so cthulhian but it should make sense if you var_dump stuff there and content taxonomy DIDNT change something.. ->$element['#field_name'] is evaluated to a string like ->($[..]) http://php.net/manual/en/language.operators.precedence.php