CodeIgniter Forums
Create a Popup window - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Create a Popup window (/showthread.php?tid=42100)



Create a Popup window - El Forum - 05-26-2011

[eluser]Unknown[/eluser]
Hi ,
In my Application i need to show a new popUp window. how could i do this ?. Basically i created a Tab Called 'New Reg Form' when user Click this i show new popup window .

in Main.php i added a tab
Code:
<LI><A  href="&lt;?=base_url();?&gt;regform_control/mymethod">RegForm</A></LI><br />

and i transfer the control to contoler class called regform_control. where i declared a method called mymethod what could i add in this method to show a pop up window. or give the best way to generate the pop up window.


Create a Popup window - El Forum - 05-26-2011

[eluser]Unknown[/eluser]
Try this:
Place the following on the onclick event of <a> tag: onclick="window.open('&lt;?=base_url();?&gt;regform_control/mymethod','mywindow','menubar=1,resizable=1,width=350,height=250');"
in the view page
and in the controller regform_control you have the function somewhat like
function mymethod(){

$this->load->view("popup.html");
}
popup.html is the page that opens in the pop-up


Create a Popup window - El Forum - 05-26-2011

[eluser]DeaD SouL[/eluser]
Hi,

I didn't understand what you meant,.. I think you was asking how to make a popup or where to put it?

Let's say you have a view called layout.php which will hold all your nav-menu links

Code:
&lt;html&gt;
....
&lt;!-- your main nav --&gt;
&lt;?php
$atts = array(
    'width'      => '800',
    'height'     => '600',
    'scrollbars' => 'yes',
    'status'     => 'yes',
    'resizable'  => 'yes',
    'screenx'    => '0',
    'screeny'    => '0'
);

echo anchor_popup('regform_control/mymethod', 'RegForm', $atts);
?&gt;
....
&lt;/html&gt;


and your controller
application/controllers/regform_control.php

Code:
class Regform_control extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
    }
    public function mymethod()
    {
        // your validation rules

        // and show the registration form view
        $this->load->view('reg_form');
    }
}

and your registration form view
application/views/reg_form.php
should be a normal form..


so the popup link has nothing to do with the reg. form... Since it is only a link to a page that shows nothing but the form.


read more about url helper

good-luck