【问题标题】:TYPO3: Use t3lib_TCEforms in frontend pluginTYPO3:在前端插件中使用 t3lib_TCEforms
【发布时间】:2012-12-28 01:08:52
【问题描述】:

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

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

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

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

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

【问题讨论】:

    标签: forms typo3


    【解决方案1】:

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

    这是一个链接,告诉我们 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;
    

    仍在寻找具有自定义输入字段模板的工作示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-03
      • 2014-11-09
      相关资源
      最近更新 更多