Hi.
I am trying to place an imagefield image directly to the right of the node title of a Story, but don't really know how to hook into it. It would be great if I could access it directly from node.tpl.php, something like this:
...
<?php if ($imagefield && $type=="story") { print "<img src=\"$imagefield\" align=right>"; } ?>
<h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2>
...
Comments
Comment #1
yched commentedYou can use the
$<FIELD_NAME_renderedvariable in your node template.Since the imagefield is already rendered with all the contents of the node in the $content variable, you'll probably need to check the 'exclude' checkbox for the field on CCK's 'Display Fields' screen, so that you don't end up with duplicate display.
For more informationn, install advanced_help module and see the 'Theming CCK data in nodes' section in CCK's help pages.
Comment #2
hba commentedThanks! If others are interested, here's what I did:
1) Read the theming guide, available under modules/cck/help/theme-node-templates.html
2) Created my image field on Story, with name "field_nodeimage"
3) Copied node.tpl.php to node-story.tpl.php in my theme. Edited node-story.tpl.php and added near the top:
4) Edited my style.css to make "field-field-nodeimage" float to the right:
Comment #3
green monkey commentedthank you for the above post