我有这个代码,我试图添加一个id =""或者类=""对于这两个select.option中的每一个....请有人帮我一把,我尝试了不同的方法和位置,但它只是不起作用......
$status []=JHTML::_('select.option','1',JText::_('Yes'),'id','title');
$status []=JHTML::_('select.option','0',JText::_('No'),'id','title');
在网站上,此代码看起来像
<label for="show_map1">Yes</label>
<label for="show_map0">No</label>
我想要实现的目标是:
<label for="show_map1" id="map_yes">Yes</label>
<label for="show_map0" id="map_no">No</label>
有人可以帮我一把吗?
谢谢
答案 0 :(得分:0)
试试这个,
$manufacturers = array ('Nike','Adi');
$lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id );
//$manufacturers is the options array
//virtuemart_manufacturer_id is the id and name of the filed
//'class="inputbox"' you can add additional class here
//$product->virtuemart_manufacturer_id is used for set default selection like Nike or Adi here.
echo $lists['manufacturers'];
希望能帮到你。