繁体   English   中英

TYPO3:在前端插件中使用t3lib_TCEforms

[英]TYPO3: Use t3lib_TCEforms in frontend plugin

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

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

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

我在前端找到了它,但是找不到任何可用的示例:t3lib_TCEforms_fe.php(扩展了常规的t3lib_TCEforms)

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

我的工作正常,但前端代码不是那么好

这是一个告诉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;

仍在寻找带有客户模板的工作示例,用于输入字段。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM