我正在使用 Drupal 6。我在文件 comment_field.module 中有这个表单:
function comment_fields_example_comment_fields_info_alter(&$info) {
$info['all'] = array(
'feeling' => array(
'#title' => t('Come giudichi il servizio di Erremmeservice?'),
'#type' => 'radios',
'#default_value' => 'neutral',
'#options' => array(
'good' => t('Positivo'),
'neutral' => t('Medio'),
'bad' => t('Negativo'),
),
),
);
}
我在我的主题的文件 comment.tpl.php 中有这段代码:
<?php if (!empty($comment_fields_feeling)) :?>
<p>Giudico il servizio offerto da erremmeservice : <?php print $comment_fields_feeling ?>.</p>
<?php endif; ?>
现在一切正常,但我应该有这个:
- 如果用户选中“Positivo”选项,则打印的结果为绿色(或只是一个类......)
- 如果用户检查选项“Medio”,打印的结果为黄色(或只是一个类......)
- 如果用户检查选项“Negativo”,打印的结果为红色(或只是一个类......)