Hallo you out there.
I have the following problem:

I have a content-type "gallery" with several ckk-fields, and most important: ckk image-fields which are multiple value (for galleries and slideshows).

With that content-type i have created some articles and its all okay.

But now I really want to have a page (lets call it "glance") which shows the title and JUST ONE (the first) image of every article i made with that content type.

I already have embeded a view in glance so every article´s title and ALL :( its images are shown.
But i just want one ! How can I manage this ? I just work with images out of imagefield no image-nodes or something like that....

Pleeease help this young man from Berlin/Germany ;)

Comments

Roborobotus’s picture

Hello Young Man from Germany ;)

I've had a similar problem and I've decided to redesign my content type. Now I have two image fields in the user form.

1) Image1 (multiple values = false) (user is told, that this should be his best pic, because it will be his avatar and will be shown 'outside' his post)
2) Image2 (multiple values = true)

In my view I'm displaying only Image1 fields.

I suppose there's a second option. You can modify the view and force it to display only the first picture. Check out my other post earlier today: http://drupal.org/node/219411

Hope this helps a bit. Greetings from a young man from Warsaw/Poland ;)

nofue’s picture

Servus vom Bodensee.

That's a theming problem -- get the output of "view wizard" and spot the part of the code where the images are sent to screen. Should be a loop foreach...

Follow the view wizards instructions to build a theming function and replace that foreach loop with a single image -- if you only want the first one that's an easy thing...

Norbert

-- form follows function

Norbert

-- form follows function

FlymastaFlex’s picture

Ja mei !
Althought its a shame for an franconian-born man to get help from a bavarian....
.... i will check this second option out tomorrow. Didnt use the theme wizard yet. If i have made it i will post it...

Grüße !

davyvdb’s picture

Check out the Content Templates module... http://drupal.org/project/contemplate

You can specify the html for the node body / teaser / RSS with it.

FlymastaFlex’s picture

I still dont get this thing working.
The problem is that this image_field is multi-value, and i dont have access from views on it. You just can control which field shall be shown. Ant this is multivalue, so all pics are in it.
So neither contemplate nor theme wizard could solve that problem.
I now work with GLOBALS which is not a apropriate way i think...

nofue’s picture

Servus, Franke!

First of all: I'm from Styria, but living in Vorarlberg -- so don't worry about Bavarians helping you :)

OK, to your problem...
I made a cck field 'newsphoto' which is a multivalue image field. The code to display all those images is:

    <div class="gallery">
        <?php if (isset($node->field_newsphoto[0]['filename'])) { ?>
            <?php foreach ((array)$node->field_newsphoto as $item) { 
              <div class="galleryitem">
              <!-- display that image -->
              </div> <?php } /* end of foreach */ ?>
              ...

All you have to do is:
a.) make a file holding the code for that node (f.e. image_node.tpl.php - be sure you understand how to create names for tpl.php files and where to put them!)
b.) put the code for that very node into that file (by copying the stuff from views wizard or contemplate)
c.) change that foreach loop like that above to something like

    <div class="gallery">
        <?php if (isset($node->field_newsphoto[0]['filename'])) { ?>
              <div class="galleryitem">
              <img src="<?php $node->field_newsphoto[0] ?>" />
              </div>
              ...

That should do what you need...

Norbert

-- form follows function

Norbert

-- form follows function

FlymastaFlex’s picture

THX.

I surely will need this later.
I found out how to just use views for the thing i need..

But thank you very much !

erebus1’s picture

did you ever figure this out?

i have the same problem

FlymastaFlex’s picture

Yes, by just using views:

View type: list
Nodes per page: 0
At fields, add the [field_yourimage] you need and set the handler on "do not group multiple values"
At filters add the node type you want and add the filter node:distinct (!!)

kulfi’s picture

of fildding by sharing this :)