如何在cakephp中创建单选按钮并将图像附加到每个按钮?即便可能,我正在使用
创建一个动态单选按钮列表echo $this->Form->input('db.field', array('type' => 'radio', 'options' => $myOptions, 'label' => 'myLabel')); ?>
有什么帮助吗?谢谢:D
答案 0 :(得分:2)
您可以简单地将图像放在选项数组中:
$myOptions = array();
$myOptions['power'] = $this->Html->image('cake.power.gif');
$myOptions['icon'] = $this->Html->image('cake.icon.png');
echo $this->Form->input('db.field', array('type' => 'radio', 'options' => $myOptions, 'label' => 'myLabel')); ?>