I created my own node-type with cck.
It has the following extra fields (label/name/type):
- Event note / field_note / text
- Location / field_location / text
- Picture / field_image / image
The field_image field is multiple so I can add multiple images that will be grouped within lightbox2. This works fine. In the view I see the thumbnails of all added images and by clicking lightbox appears with the group function.
But what if I want only ONE thumbnail in the view, linked to the group of all images I added to the note?
The name of my node type is 'event'. So I created a file named 'node-event.tpl.php'
<?php print $body ?> and <?php print $content ?> results both in printing everything the node has: title, body, event note, location and pictures.
<?php print $content['field_note']['#children'] ?> results in an error: "Fatal error: Cannot use string offset as an array in /var/www/sites/all/themes/descartes/node-event.tpl.php on line 18"
=> 1st problem: no way to access single fields for printing
<?php print $field_image[0]['view'] ?> results in printing only the 1st picture but is breaking the group.
=> 2nd problem: no way to show only ONE image without breaking the group.
I think it's not a big deal, but I don't know what to try next. Please give me a hint!
thanks
haggins
Comments
1st problem solved
okay, here's my solution of printing single fields:
but I don't have a solution for my 'main' problem (only 1 thumbnail) so far...
Try doing a var_dump($node)
Try doing a var_dump($node) in your template to see everything you have available. I would imaging you're looking for
$node->field_xxx_yyy[0]['value']
Hope that helps!
__________________________________________________________
Mark Theunissen
(work) Digital People
(personal) Code Baboon
Yes, thx! Now, it works
Yes, thx!
Now, it works nearly as it should:
Shows only one image as a link to the group. BUT it is shown in original size. Without custom template an imagecache-preset is used which shows a thumbnail -> 75% size. Didn't spot the trick yet ;)
EDIT:
ok, here's the code as it works for me:
Slight adjustment
Thanks for pointing me in the right direction. I was stuck in a never-ending loop trying to do the same but within views.
I have made a slight change to your code to pass lightbox2 the image caption if there is one (see below). The only thing I am trying to figure out now is how to get the default image-cache and lightbox2 settings set in "display fields" to be applied on the first image. The remaining don't bother me as they aren't shown anyway. Any ideas?
Here is the slight code adjustment:
did you make a new template for the node?
I am using Drupal 6 with Lightbox 2.
I have this code so far and can get the first image to display but can't get the other images to load as a slideshow:
i've worked out it's becase i'm using image_attach
so i have to find a way to get the values out of the image_attach array...
i had a look at the output from image_attach and it's stored as a string which makes for messy business to try and get segments of the string for this type of functionality. I have instead added a new CCK field and am now referencing this instead :).
Worked great
Thank you so much!
Adding a plus icon
How can you add a plus icon to indicate more photos? Apple's site puts a little plus button over the corner of the photo if there are additional photos to view and that is something I'm trying to do. Has anyone done this?