我需要在Joomla3.1中创建一个新的自定义字段。但你做不到。我很少看到关于在Joomla2.5中创建自定义表单的文章,但是在这个新版本中我不能。
任何人都会帮助我,我需要在Joomla3.1的文章后端中创建自定义字段,而不是在Joomla2.5中。
在这种情况下,我需要在后台创建joomla文章。
<field name="totalprice" type="text" label="COM_CONTENT_TOTAL_PRICE_LABEL" description="COM_CONTENT_TOTAL_PRICE_DESC" class="input-xlarge" size="30" required="true" labelclass="control-label" />发布于 2013-10-16 22:04:03
您将在这里找到一个您可以遵循并根据您的需要进行调整的示例:
totalprice.php文件的代码示例
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
//defined('JPATH_BASE') or die; TODO CHECK THIS
jimport('joomla.form.formfield');
/**
* Created by custom field class
*/
class JFormFieldTotalPrice extends JFormField
{
/**
* The form field type.
* @access protected
* @var string
*/
protected $type = 'totalprice';
/**
* Method to get the field input markup.
* @access protected
* @return string The field input markup.
*/
protected function getInput()
{
// Initialize variables.
$html = array();
//Load user example. REPLACE WITH YOU CODE
$html[] = '<input type="text" name="totalprice" value="' . $your_data->value . '" />';
return implode($html);
}
}
?>https://stackoverflow.com/questions/19412630
复制相似问题