DRUPAL: adding CCK image fields to other CCK fields
can I add a CCK image field to another CCK field ? I would like to add icons for each item i add. At the moment I can only write 开发者_运维问答the description.
This would be very cool functionality!
You could do this with JQuery if you want to add an icon by file type. For example see http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/ tip #10.
If you want to be able to specify an icon per item added (so it could be a different icon for every added item) then how you do it depends on how you are displaying it.
So lets say each CCK field is being added to a particular node type and you have a view that lists those nodes then I'd recommend adding a CCK image field to the node (so that each node of the required type has the descriptively named CCK image field and the original CCK field) and then adding a custom template to the view that controls how the image and field are output relative to each other.
I was about to write an example of how to do that but thought I'd check if that describes your needs before I add unnecessary info to the response.... can you clarify what you're trying to do?
You can do this using CCK 3.0's multigroup functionality. Note that there is no stable release for this branch, but it seems to work fine for most use cases.
You would add an image field (icon) and a text field, into a multigroup, and then when adding a new node, instead of the traditional 'add another' button, there is a button to add another group of associated fields.
精彩评论