By stanbroughl on
I've got a number of cck fields where users can enter multiple values, which i'd then liek to output in a bulleted list form - i'm trying to work out how to use the list theme function but at the moment i'm getting the list value printed out (what i want) but i'm also getting either the node ID number or the user ID number where i'm referencing users.
This is an example field and the theming code i'm using in contemplate:
<?php foreach ((array)$field_resp_t_personnel as $item) { ?>
<?php print theme('item_list', $item) ?>
<?php } ?>
and this is what its outputting:
<div class="item-list"><ul><li>4</li><li><a href="/user/1" title="View user profile.">User 1</a></li></ul></div> <div class="item-list"><ul><li>5</li><li><a href="/user/5" title="View user profile.">User 2</a></li></ul></div> <div class="item-list"><ul><li>3</li><li><a href="/user/3" title="View user profile.">User 3</a></li></ul></div>
does anyone have any suggestions or ideas where to go from here?
Comments
From what you have show this should help
Try change this
to
though you may need to change it to
when i use the first one i
when i use the first one i get the word ARRAY bullets out 3 times - which is the number of items in that list so its a start!
when i use the second one (with the view option - as i want links to the user pages) i'm getting this error come out:
Invalid argument supplied for foreach() in /homepages/44/d176613683/htdocs/includes/theme.inc on line 877 and no content for that field.
any other suggestions? i've gone round in circles and i'm a bit confused now! thanks for your help with this - great appreciated :)
Sorry, type on my part
$mylist = $item['view'];should have been$mylist[] = $item['view'];(square brackets added after $mylist)works like a charm!!! thanks
works like a charm!!! thanks steve - you always seem to come to my rescue! :)
CCK Multiple values common formats
I think this is something that should be included in the CCK module. The need to output formatted multiple values of anything, particularly as a bulleted list, is very common. Another could be a table, cells could be separated by commas, and each value a row for example.
==========
www.online-business-card.com
www.e3m.co.uk