By stephtek on
I have two different imagecache presets (one mail larger image and smaller thumbnails) in my CCK content type. I am using Contemplate to style my content but for some reason when i am trying to style it its only displaying my one large image and one of the thumbnails even though I uploaded 6 or 7.
Here is my template code in contemplate:
<table class="gallery" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="gallery-main-img"><?php print $node->field_gallery_main[0]['view'] ?></td>
<td valign="top" class="gallery-small-img"><?php print $node->field_gallery_sm[0]['view'] ?></td>
</tr>
</table>
<h1><a href="<?php print $node->path ?>" title="<?php print $title ?>"><?php print $title ?></a></h1>
<?php print $node->content['body']['#value'] ?>
This is the thumbnail code: <?php print $node->field_gallery_sm[0]['view'] ?>
Am I doing this right? This is my first attempt using CCK and ImageCache.
Comments
foreach is your friend
I still a lot to learn about
I still a lot to learn about PHP, but I've managed to cobble together the following code from examples I've picked up. You might find it helpful.
I wanted the first image to display as a large image and any extra images as thumbnails. To do so you need to use the $delta variable. I also check the first images size and add the width and height into the html tags for the first image. My thumbnails are all the same size so the size is fixed.
The links also call on lightbox in the links. You could easily have the thumbnails change the main image when you click on them.
If anyone has ideas on how to streamline my code feel free to chime in.