Codeigniter:在“从控制器的视图”中调用一个函数

|                我是Codeigniter的新手。在示例应用程序中,在Main.php(查看文件夹)中添加一个名为\“ RegForm \”的新选项卡。当我单击RegForm选项卡时,它将加载新窗口(宽度= \'800px \'高度= \'500px \')。我理解这个概念,但我不知道如何在Codeigniter中编写代码。 当我单击RegForm选项卡时,Basicall我会在Controller文件中调用一个函数。我需要在View中调用一个函数,在其中加载带有属性的窗口。我正确。     
已邀请:
你可以做到这一点(如果我理解正确的话): 视图\'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);
    }
}
然后,在\'myview \'中,以您想要的方式显示
$properties
希望这会有所帮助,lmk     

要回复问题请先登录注册