Hit my next problem; hope someone out there can point me in the direction since I'm fairly sure this one is easier than the last.
I've overwritten my CCK created node template (node-content-car.tpl.php) so that I can completely control the format rather than output $content. My first problem is I want to output thumbnails (I'm using upload_image module) with links to the full image node and I can't for the life of me get it to work. I thought the code below would do the trick.
<?php if ($files): ?>
<tr><td class="upload-image-images" colspan="2">
<?php
foreach ($files as $file) { print l(image_display($file, 'thumbnail'),'node/'.$file->nid, array(), null, null, FALSE, TRUE); }
?>
</td></tr>
<?php endif; ?>
Unfortunately that outputs
<tr><td class="upload-image-images" colspan="2">
<a href="/public_html/cnl-drupal/node/38"></a>
<a href="/public_html/cnl-drupal/node/32"></a>
</td></tr>
I guess that's a problem with how I'm using the image_display function, right?
My second question is regarding output of normal fields. At the moment I'm outputting each field individually meaning if I add any more fields I have to go back and add them to the template. How would I grab all fields for the node and cycle through each of them, outputting to the screen?
Many thanks!
Comments
Same issue
I just opened a support issue about this: http://drupal.org/node/79209
problem in function call
image_display()expects$fileto be a node object. Here is my attempt:NOTE: code not tested.
- Corey
no img tags generated
Thanks for the fast reply! Please excuse my extreme noobishness. I'm learning fast.
The following code:
Renders this:
What do I need to reference to get only the
The previous support request is now here.
Cheeers,
Ian
Actually
I had a similar situation. I use flexinode though and needed to rebuild the attachment list with non-image file links and thumbnails for images. After looking at the upload_image module code I decided to copy/paste the whole attachment list generating section below into a custom function in my template.php and call that function from my node specific template file node-flexinode-x.tpl.php
This code is in the node hook under case 'view': on line 61 and below.
If you only need thumbs and not the other files just strip out some code. But this way 100% replicates the module's attachment display.
Hope this helps,
Mike