Welcome Guest, Not a member yet? Register   Sign In
Creating a popup window from within a Controller
#1

[eluser]Unknown[/eluser]
Is it possible to call a view from within a controller function, where the view is a popup window?

I understand the use of anchor_popup() but I need to open the popup from the controller rather than from a view.


Why I want to do this.
Within my controller I have just validated a user login. If the user table indicates that the logging in user has not accepted the site's Terms and Conditions, I want to display these for acceptance in the popup. If they have previously accepted the Terms then I will redirect the user to the Members area.

(I've sorted the check box and Accept button in the popup - no issue there).

Many thanks.
David
#2

[eluser]Pedro Luz[/eluser]
take a look a the javascript class

http://ellislab.com/codeigniter/user-gui...cript.html
#3

[eluser]Twisted1919[/eluser]
The approach is wrong, way too wrong.

In your controller, set a variable, something like $agree=false; by default, if the user agrees your terms, set it to true.

Then in your view, do a check, something like
<?php if(!$agree):?>
show_popup();
<?php endif;?>

where show_popup(); is a javascript function that shows the popup in the browser .
Of course, instead of a javascript function you can push it in jquery's document ready function, but the idea is that, YOU DON'T DO IT IN YOUR CONTROLLER.




Theme © iAndrew 2016 - Forum software by © MyBB