我試圖在登錄和註冊表單中加入相同的操作。這就是我想: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