By eviljoker7075 on
(sorry for posting this many questions in such a short time - this is the last for a while I promise!)
Basically, using contemplate how can I stop fields being displayed if the user has not entered a value?
I have several fields that I created using CCK that are optional, however when I display them using contemplate the header still shows up no matter if a value has been entered, or left out...
Comments
This is the code I have
This is the code I have tried, which doesn't work:
<?php if ($node->field_leastfavouritetrack) { ?><?php print $node->field_leastfavouritetrack?><?php } ?>Check the list with 'body
Check the list with 'body variables' that contemplate provides... You will see that $node->field_leastfavouritetrack is an array. So even if the keys within that array are empty, the array itself is not, so it will allways return TRUE.
Try this:
<?php if ($node->field_leastfavouritetrack[0]['view']) { print $node->field_leastfavouritetrack[0]['view'] } ?>(and note that you can delete php closing and opening tags when they touch eachother like this:
?><?php)