开发者

Popup login page

I have created a login page at www.mywebsite.com/members/login

I'm using Zend Framework, Now I wanna be able to have a popup login dialog, so that people don't have to be redirected too many times for authentication, I preferably wanna use a jquery dialog to开发者_如何学运维 do that.

I want this to have minimal effect on the login page, I mean I don't wanna reprogram the whole thing again,

Now what's the best way of doing this?

I can think of couple of options 1- Have all the code in all pages, then "dialogifiy" it when needed 2- Use an Iframe within a jquery dialog to show the content of the login page

I think 2 is better because the contents of the iframe can be ssl while the rest of the page is not, so that is good

But I was wondering if there are any better techniques of doing it or not.


You need to create login form as a "widget" by using action helpers . Here is a great way to do it by the project lead of Zend Framework himself:

http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html


Setup

Put the login html in a separate file (login.html). Note that it doesn't have to have the <html> <head> or <body> tags, just wrap it in a <div> with an id. This should include all necessary fields and a submit button.

Login Process

The clicks on the 'login' link or button, at this point you will popup a dialog and begin an ajax call using jQuery's .load() function to get the html content in login.html and put it in the jQuery modal's content section. If you do any client side form validation or need extra css, look at jQuery's $.getScript() and (for the css) simply add a element to the head of your page with an href pointing to your css file.

Now that everything's loaded, the client can submit the form like normal from the dialog. If you want, you can also use ajax to submit the form to the server.

Let me know if you need help with specific code or have questions about this setup.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜