我是Codeigniter的新手。在我的示例应用程序中,我在Main.php(查看文件夹)中添加了一个名为"RegForm"的新选项卡。当我单击RegForm选项卡时,它会加载新窗口(宽度='800px'高度='500px')。我理解这个概念,但我不知道如何在Codeigniter中编写代码。Basicall当我单击RegForm选项卡时,我调用Controller文件中的一个函数。我需要在View中调用一个函数,在View中我加载一个带有属性的窗口。amm我纠正了。
YOu可以做到这一点(如果我理解正确的话):
视图"someview"包含以下链接:
$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是URL助手中的一个函数,只需自动加载它,它真的很有用)
在控制器"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,在"myview"中,您可以按照自己想要的方式显示$properties
希望这有帮助,lmk