0

我想尽可能多地使用标准 TYPO3 来创建一个表单来编辑来自 tx_mytable 的单个记录。

在 pi1 中,我为表加载 tca: t3lib_div::loadTCA('tx_mytable');

现在我想使用标准函数来创建我的表单元素,或多或少就像在后端完成的那样......

我在前端找到了这个,但找不到任何工作示例:t3lib_TCEforms_fe.php(扩展了普通的 t3lib_TCEforms)

这是正确的方法还是有更好的方法?

4

1 回答 1

0

我得到了一些工作,但在前端并不是那么好的代码

这是一个链接,说明 TCA 还不够,但需要数组中的两个新条目 http://www.martin-helmich.de/?p=15

它是 itemFormElName 和 itemFormElValue

// include tceforms_fe (place outside class where pipase is included)
require_once(PATH_t3lib.'class.t3lib_tceforms_fe.php');

// load TCA for table in frontend
t3lib_div::loadTCA('tx_ogcrmdb_tasks');

// init tceforms
$this->tceforms = t3lib_div::makeInstance("t3lib_TCEforms_FE");
$this->tceforms->initDefaultBEMode(); // is needed ??
$this->tceforms->backPath = $GLOBALS['BACK_PATH']; // is empty... may not be needed

//////////REPEAT FOR EACH INPUT FIELD/////////
// start create input fields, here just a single select for responsible

// conf used for tceforms similar to but not exactly like normal TCA
$conftest = array(
    'itemFormElName' => $GLOBALS['TCA']['tx_ogcrmdb_tasks']['columns']['responsible']['label'],
    'itemFormElValue' => 1,
    'fieldConf' => array(
        'config' => $GLOBALS['TCA']['tx_ogcrmdb_tasks']['columns']['responsible']['config']
    )
);

// create input field
$this->content .= $this->tceforms->getSingleField_SW('','',array(),$conftest);

// wrap in form
$output = '<form action="" name="editform" method="post">';
$output .= $this->content;
$output .= '</form>';

// wrap and return output
return $output;

仍在寻找使用自定义模板作为输入字段的工作示例。

于 2013-01-01T22:05:32.020 回答