Php 如何在社交引擎的控制器中添加表单元素

Php 如何在社交引擎的控制器中添加表单元素,php,frameworks,socialengine,Php,Frameworks,Socialengine,试试这个代码 class Module_PhotoController extends Core_Controller_Action_Standard { public function nameAction() { $this->view->form = $form = new Modulename_Form_Fromname(); $this->addElement(

试试这个代码

class Module_PhotoController extends Core_Controller_Action_Standard
{   
    public function nameAction()
    {                           
        $this->view->form = $form = new Modulename_Form_Fromname();
        $this->addElement('Text', 'sender', array(
            'label' => 'Send to',
            'maxlength' => '40',
            'filters' => array(
                //new Engine_Filter_HtmlSpecialChars(),
                'StripTags',
                new Engine_Filter_Censor(),
                new Engine_Filter_StringLength(array('max' => '63')),
            )
        ));
    }
}  
试试这个代码

class Module_PhotoController extends Core_Controller_Action_Standard
{   
    public function nameAction()
    {                           
        $this->view->form = $form = new Modulename_Form_Fromname();
        $this->addElement('Text', 'sender', array(
            'label' => 'Send to',
            'maxlength' => '40',
            'filters' => array(
                //new Engine_Filter_HtmlSpecialChars(),
                'StripTags',
                new Engine_Filter_Censor(),
                new Engine_Filter_StringLength(array('max' => '63')),
            )
        ));
    }
}  

正确的方法是编辑
/application/modules/Modulename/Form/Fromname.php
中的文件,并使用
addElement
向表单添加特定元素。在控制器中构造表单不是最佳的SE编程实践。

正确的方法是编辑
/application/modules/Modulename/Form/Fromname.php中的文件,并使用
addElement
向表单添加特定元素。在控制器中构造表单不是最佳SE编程实践