我使用joomla 2.5,我想创建一个存储在同一模块中的自定义表单字段类型.
在XML中:
<fieldset name="basic" addfieldpath="/modules/mod_royalslider/fields"></fields> <fieldset name="basic"> <field name="title" type="City" label="anythging" description="" /> </fieldset> </fields>
在文件/modules/mod_royalslider/fields/city.PHP中
<?PHP // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); jimport('joomla.form.formfield'); class JFormFieldCity extends JFormField { protected $type = 'City'; // getLabel() left out public function getInput() { return '<select id="'.$this->id.'" name="'.$this->name.'">'. '<option value="1" >New York</option>'. '<option value="2" >Chicago</option>'. '<option value="3" >San Francisco</option>'. '</select>'; } }
现在它告诉我错误,当我删除
< fieldset name =“basic”addfieldpath =“/ modules / mod_royalslider / fields”>< / fields>