1

In Drupal 7 Admin, I added a choice field of Type "List (text)" and widget "Check boxes/radio buttons", in which I see the list of check boxes in the Admin. But I don't see anything in the Live Website (it does not show up)

Below is the code that I am using in the node-view-VIEWNAME.tpl.php page:

<?php if ( render ($content['field_choice']) ): ?>
Choice(s): <?php print render ($content['field_choice']); ?>
<?php endif; ?>

The code above works fine for Fields of Type Text. How would I modify the code to render the content for check-boxes?

  • Try after remove the if condition. Inside if condition you are rendering the element once, once it rendered then it will not render again. – ARUN Nov 15 '13 at 9:16
1

Never mind. I had a typo in the $content[] array element. The one I set in the admin is slightly different than the one I declared in the template. (small typo). Amazing!

My code above also works fine with check-boxes.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.