[英]Symfony 1.4 form is not rendering on template
My symfony 1.4 application's form is not rendering on template.Template is loading properly.Without form attributes it's loading nicely.When add a new form in controller and load it to the template only i'm getting a blank page.Why is that? 我的symfony 1.4应用程序的表单未在模板上呈现。模板正在正确加载。没有表单属性,它正在很好地加载。当在控制器中添加新表单并将其加载到模板时,我只会得到一个空白页面,为什么?
Update: 更新:
Following is my php error log content. 以下是我的php错误日志内容。
Fatal error: Class 'LoginForm' not found in C:\wamp\www\symfony_app\apps\symfony_app\modules\user_login\actions\actions.class.php on line 21
PHP Stack trace:
{main}() C:\wamp\www\symfony_app\web\index.php:0
sfContext->dispatch() C:\wamp\www\symfony_app\web\index.php:7
sfFrontWebController->dispatch() C:\wamp\bin\php\php5.5.12\pear\symfony\util\sfContext.class.php:170
sfController->forward() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:2352
sfFilterChain->execute() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:665
sfRenderingFilter->execute() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:1031
sfFilterChain->execute() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:995
sfExecutionFilter->execute() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:1031
sfExecutionFilter->handleAction() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:933
sfExecutionFilter->executeAction() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:947
sfActions->execute() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:952
user_loginActions->executeIndex() C:\wamp\www\symfony_app\cache\symfony_app\prod\config\config_core_compile.yml.php:459
This is the solution which i came up with to this.I was first created a seperate form class by extending symfony base form.At that point my form didn't worked.So i added the form's attributes inside the controller's action method instead of defining it in a seperate file.Now it's working fine. 这是我想出的解决方案。我首先通过扩展symfony基本表单创建了一个单独的表单类,当时我的表单没有用,所以我在控制器的action方法中添加了表单的属性而不是定义放在单独的文件中。现在,它可以正常工作。
class loginActions extends sfActions
{
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->form = new sfForm();
$this->form->setWidgets(array(
'name' => new sfWidgetFormInputText(),
'password' => new sfWidgetFormInputPassword(),
));
}
}
Update form class content: 更新表单类内容:
class LoginForm extends BaseForm
{
public function configure()
{
$this->setWidgets(array(
'name' => new sfWidgetFormInputText(),
'password' => new sfWidgetFormInputPassword(),
));
}
}
Now the form thing is working.Previously i was checked with url, 现在表单工作正常了。以前我用url检查过,
http://localhost/symfony_app/web/login/index.
In this way it didn't worked.But after i access through, 这样就没有用了。但是当我访问完之后,
http://localhost/symfony_app/web/symfony_app_dev.php/login/index.
When accessing through this url it's working. 通过此网址访问时,它可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.