Posted by Percept on May 3, 2010 at 3:29pm
Jump to:
| Project: | Node displays contributions |
| Version: | 6.x-2.x-dev |
| Component: | ND CCK |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
I'm using DS with view display to create an overview of all the cars in a category. Each car has un undefnined number of pictures which need to show on the detailpage of the car (node). In the listing however I only want to show a single picture but I can't seem to limit this right now? In other words, is there a way to limit the output from picture fields?
Comments
#1
Not yet - I've had this request before see #763344: Ubercart product images for helping formatters - there is no way right now limit this by default - DS 1.2 will have support for views fields but I need to find a way to have that same limiting options by default in our interface, for all CCK fields. Moving to right queue and marking as feature request.
#2
How do you currently solve this problem on your sites? In the linked issue there is talk about using a custom formatter function. Is that the recommended way to solve this problem currently?
#3
That's indeed the only way it can work right now by having custom formatters.
#4
Ok, this is pretty insane todo actually - added the code snippet to the snippets page http://drupal.org/node/700056
#5
I've found a quick workaround to show only the first value of any cck fields in teasers.
With Node displays contributions module:
Copy sites/all/modules/nd_contrib/nd_cck/nd_cck.tpl.php to your theme directory, if it doesn't already exist.
Without Node displays contributions module (plain CCK module):
Copy sites/all/modules/cck/theme/content-field.tpl.php to your theme directory, if it doesn't already exist.
Then edit the copied file in your theme directory, change from
<?php$count++;
?>
to
<?php$count++; if ($teaser) { break; }
?>
And then flush the theme registry.
#6
See #793656: Show only first image from multi-value imagefield (or "group multiple values").