我试图在登录和注册表单中加入相同的操作。这就是我想:Symfony:在同一页面中加入两个表单
模块/ miembros /的actions.class.php
public function executeAux(sfWebRequest $request)
{
// I execute this action
}
模块/ miembros /模板/ auxSuccess.php
<?php include_component('sfGuardRegister', 'register'); ?>
<?php include_component('sfGuardAuth', 'signin'); ?>
模块/ miembros /组件。 class.php
public function executeSignin($request)
{
if ($request->isMethod('post') && ($request-
>getParameter('submit')=='signin')){
$this->form->bind($request->getParameter('login'));
if ($this->form->isValid()){
$this->getController()->getActionStack()->getLastEntry()->getActionInstance()->redirect('@home');
}
}
}
模块/ miembros /模板/ _signin.php
<form action="<?php echo url_for('miembros/aux?submit=signin') ?>"
method="post">
<?php echo $form['email_address']->renderLabel() ?>
<?php echo $form['email_address'] ?>
...
它工作正常,但我想知道你是否有其他的选择。例如,我不喜欢该行: $ this-> getController() - > getActionStack() - > getLastEntry() - > getActionInstance() - >重定向('@home');
问候
哈维
我有一个基于您的意见的新建议。 – ziiweb 2010-04-23 16:56:27