I am New to Codeigniter. In my Sample Application I add a new Tab called "RegForm" in my Main.php(View Folder). When i Click the RegForm Tab it load the New Window(width='800px' height='500px'). i understand the concept but i dont know how to write coding in Codeigniter.
Basicall i call a function in Controller file when i Clicked the RegForm tab. and i need to call a function in View where i load a window with properties. amm i correct.
Add a comment
|
1 Answer
YOu could do this (if I understood correctly):
View 'someview' contains this link:
$atts = array(
'width' => '800',
'height' => '500',
'scrollbars' => 'yes',
'status' => 'yes',
'resizable' => 'yes',
);
echo anchor_popup('mycontroller/mymethod','Click this for a popup',$atts);
(anchor_popup is a funcion in the URL helper, just autoload it, it's really useful)
in Controller 'mycontroller':
class Mycontroller extends CI_Controller {
//function index()
// other functions
function mymethod()
{
$this->load->model('mymodelforthis');
$data['properties'] = $this->mymodelforthis->get_properties();
$this->load->view('myview',$data);
}
}
THen, in 'myview', you display $properties the way you want
Hope this helps, lmk
6 Comments
Srini
Hi Damien , Really Thanks to Reply it got working Greatly. but one thing how to ignore the window shows "Click this for a popup". instead directly load the view. is there any way?
Damien Pirsy
Well, if you want a new page and not a popup, just dont' use the popup ;) Do you mean 'Click this for a popup' shows as page title?
Srini
@Damn i need popup window but the window doesn't load the view. it displays href "click this for a popup". i need to load the view in pop up window.
Damien Pirsy
I believe you're implementing something wrong, because it works the way I showed you..are you calling the right controller and views? (like in the example I posted)
Srini
ya i made a small mistake. Thanks for co operating @Damien Pirsy
|