Recent blog posts
Hiding CCK Fields when using Contemplate Module
amariotti — Mon, 08/11/2008 - 15:22
At work I am building some pretty complex content driven pages with Contemplate. I have some node data being displayed in the main content area and the rest in a dynamic block using Views Arguments. To keep a better handle on the data being displayed I am the Contemplate module, which I have found to be an extraordinary module for what it can do.
I ran into an issue today where I wanted to hide the label to the field if the field was empty. After some searching online and digging I couldn't really find anything, so I did a little research on my own and was able to come up with the solution. Here it is:
<?php if ($node->your_field_name[0]['view'] != ""): ?>
<div class="field-item"><div class="your_label_class">Your label: </div><?php print $node->your_field_name[0]['view'] ?></div>
<?php endif; ?>
Be sure and replace <code>field_your_field_name</code> with your field name. Also be sure and put in your own custom css class for the label to make it your own!
So there it is!
- amariotti's blog
- 12009 reads