CakePHP 模态窗口示例
我正在使用 cakephp,并且正在尝试实现一个用于登录和注册的模态窗口,类似于 Digg.com 中的“加入 Digg! - 登录”。有谁知道库/插件/教程/截屏视频或者什么可以在 CakePHP 中实现“登录模式”?
顺便说一句,我已经完成了所有注册和身份验证过程,我只需要一个模式示例,我该怎么做?
谢谢!
I'm using cakephp and I'm trying to implement a modal-window for login and singup, similar to the one in Digg.com "Join Digg! - Login". Does anyone knows about a library/plugin/tutorial/screencast or what ever to achieve a "login modal" in CakePHP?
By the way I already have working all the registration and authentication process, I just need the a modal example, how can I do that?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Digg 上的弹出窗口是用 JavaScript 实现的。看起来他们可能有自己的代码。一种看起来非常相似的简单替代方案是 Fancybox。您可以将登录设置为自己的页面,并将其显示在 Fancybox 弹出窗口内的 iframe 中。
如果您浏览 Fancybox 文档,您会发现您可以挂钩各种打开/关闭事件,您可以使用这些事件(例如)为新经过身份验证的用户重新加载主页。
如果 Fancybox 不能满足您的需求,还有其他流行的“lightbox”JS 实现。
您可能不需要大量的 CakePHP 魔法来完成这项工作,或者更确切地说,您已经实现了您确实需要的魔法。
The popup on Digg is implemented in JavaScript. It looks like they might have their own code for it. One easy alternative that looks very similar is Fancybox. You can set up your login as its own page and show it in an iframe inside Fancybox's popup.
If you look through the Fancybox documentation, you'll find you can hook onto various open/close events which you might use (for example) to reload the main page for the newly authenticated user.
There are other popular "lightbox" JS implementations out there if Fancybox doesn't suit your needs.
You probably don't need a lot of CakePHP magic to make this work—or rather, you've already implemented the magic you DO need.
CakePHP 没有任何内置功能来创建模态窗口,但 jQuery UI 具有:http://jqueryui。 com/demos/dialog/
我推荐这个,因为它是一个标准解决方案并且设置起来非常简单。这是我在 CakePHP 网站上经常使用的方法来创建和处理模式窗口。
CakePHP doesn't have any built-in functionality to create modal windows, but jQuery UI does: http://jqueryui.com/demos/dialog/
I'd recommend this because it's a standard solution and pretty simple to set up. This is what I always use on CakePHP sites for creating and dealing with modal windows.