Symfony2嵌入了所有FOSUserBundle表单(Symfony2 embed all FOSUserBundle forms)
我正在尝试将所有FOSUserBundle表单嵌入到布局左侧的侧边栏中。
这是我的
src/My/MainBundle/Resources/config/routing.yml
:index: pattern: / defaults: { _controller: MyMainBundle:Main:index } login: pattern: /login defaults: { _controller: MyMainBundle:Main:index } resetting_request: pattern: /resetting/request defaults: { _controller: MyMainBundle:Main:index } resetting_send_email: pattern: /resetting/send-email defaults: { _controller: MyMainBundle:Main:index }
在
src/My/MainBundle/Resources/views/layout.html.twig
,我有(除其他外):<div id="sidebar"> {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %} <p>You are logged in blah blah blah</p> {% elseif app.request.attributes.get('_route') == 'resetting_request' %} {{ render(controller('FOSUserBundle:Resetting:request')) }} {% elseif app.request.attributes.get('_route') == 'resetting_send_email' %} {{ render(controller('FOSUserBundle:Resetting:sendEmail')) }} {% else %} {{ render(controller('FOSUserBundle:Security:login')) }} {% endif %} </div>
登录表单工作正常,它提交到/ login_check,然后重定向到请求的页面,如果登录名和密码是正确的,或者,如果登录名或密码错误,它会重定向到/ login(在这种情况下,它正确在侧栏中显示表单,并显示相应的错误消息)。
我在“忘记密码?”时遇到问题。 但形式。
它显示在侧边栏中,并提交/重置/发送电子邮件,但它不会重定向到任何内容。 然后它告诉我用户名或电子邮件“”不存在。
如果我评论“resetting_send_email”路由,那么“发送电子邮件”操作有效,但输出不在侧边栏中(事实上,它周围甚至没有布局)。
有任何想法吗?
I'm trying to embed all FOSUserBundle forms in a sidebar on the left of my layout.
Here's my
src/My/MainBundle/Resources/config/routing.yml
:index: pattern: / defaults: { _controller: MyMainBundle:Main:index } login: pattern: /login defaults: { _controller: MyMainBundle:Main:index } resetting_request: pattern: /resetting/request defaults: { _controller: MyMainBundle:Main:index } resetting_send_email: pattern: /resetting/send-email defaults: { _controller: MyMainBundle:Main:index }
In
src/My/MainBundle/Resources/views/layout.html.twig
, I have (among other things):<div id="sidebar"> {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %} <p>You are logged in blah blah blah</p> {% elseif app.request.attributes.get('_route') == 'resetting_request' %} {{ render(controller('FOSUserBundle:Resetting:request')) }} {% elseif app.request.attributes.get('_route') == 'resetting_send_email' %} {{ render(controller('FOSUserBundle:Resetting:sendEmail')) }} {% else %} {{ render(controller('FOSUserBundle:Security:login')) }} {% endif %} </div>
The login form works fine, it submits to /login_check, which then redirects to the page that was requested, if the login and password are correct, or, it redirects to /login if the login or password are wrong (in that case it correctly displays the form in the sidebar, with the corresponding error message).
I'm having trouble with the "Forgot password?" form, though.
It shows up in the sidebar, and submits to /resetting/send-email, but then it doesn't redirect to anything. It then tells me that the username or email "" doesn't exist.
If I comment the "resetting_send_email" route, then the "send email" action works, but the output is not in the sidebar (in fact, there isn't even a layout around it).
Any ideas?
原文:https://stackoverflow.com/questions/22507817
满意答案
问题是XML。 结构不合理。 我现在改变了结构和工作。
谢谢。
The problem was the XML. It wasn't structured properly. I changed the structure and its working now.
Thank You.
相关问答
更多OnBackKeyPress未按预期工作(OnBackKeyPress is not working as expected)
在Application Engine中使用PeopleCode的Zip文件(Zip Files using PeopleCode in Application Engine)
.get()无法按预期工作(.get() not working as expected)
导航在WinJS中未按预期工作(Navigation not working as expected in WinJS)
原型未按预期工作(Prototype is not working as expected)
功能未按预期工作(function isn't working as expected)
intdiv()未按预期工作(intdiv() is not working as expected)
peoplecode中的LoadXMLString函数未按预期工作(LoadXMLString function in peoplecode not working as expected)
使用Java类在PeopleCode中调用多个CI(Invoking Multiple CI's within PeopleCode using Java Classes)
Scala中的隐式函数未按预期工作(Implicit function in Scala not working as expected)
相关文章
更多Symfony2网站开发
我是如何在15天开发出一个网站的
强力推荐几款JS插件,
HTML5 智能form表单新属性
HTML5项目笔记2:离线系统表单设计
swing 嵌入 网页中
获得表单里的值
HMTL 表单标签
深入了解Activiti工作流流程定义
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!