Hi,
Am trying to set a node body to display using the content template module.
Would like to intoduce a line between 2 cck fields and to have an icon displayed in the beginning of the lower cck field mn_facts.Could do this with content template module and the code shown as Body Template is:
<?php print $node->content['body']['#value'] ?><table> <tbody><tr> <td><img alt="image" width="20" src="http://www.example.com/sites/default/files/note.svg" /><?php print check_plain($node->field_mn_facts[0]['value']) ?></td> </tr> </tbody></table>
The issue is, even when the cck field mn_facts is empty the icon is displayed.Is there a way to hide the icon too, when cck field is empty?
The images of 2 nodes when set to display with the same template code given above are attached.
1.gif shows the node display when the cck field mn_facts has content and 2.gif when it is empty.
Have phrased this issue similar to http://drupal.org/node/79188
-thank you
| Comment | File | Size | Author |
|---|---|---|---|
| 2.gif | 5.76 KB | nirvanajyothi | |
| 1.gif | 9.65 KB | nirvanajyothi |
Comments
Comment #1
stephtek commentedfollowing. I have the same problem.
Comment #2
Anonymous (not verified) commentedYou could always check to see if the field is empty as part of your code too,, something like the following, but being no expert, and until one comes along, its just a hint of what to look for
or use if not empty
Comment #3
stephtek commentedCant seem to figure that out?
Comment #4
stephtek commentedFigured it out for a field and an array:
Comment #5
nirvanajyothi commentedAm adding the code that worked. Hope the template is alright. It also allows to add a background color in a table the dimensions of which can be changed.
Thanks for all the hints.