CakePHP Modal Window Example

2019-07-31 00:23发布

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!

2条回答
我命由我不由天
2楼-- · 2019-07-31 00:56

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.

查看更多
老娘就宠你
3楼-- · 2019-07-31 01:21

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.

查看更多
登录 后发表回答