您好,欢迎访问一九零五行业门户网

EE开发参考_PHP教程

1.upd.article_statistics.php
ee =& get_instance();
    }
function install()
    {
        $this->ee->load->dbforge();
         $data = array(
            'module_name' => $this->module_name ,
            'module_version' => $this->version,
            'has_cp_backend' => 'y',
            'has_publish_fields' => 'n'
        );
$this->ee->db->insert('modules', $data);
$data = array(
            'class'        => $this->module_name ,
            'method'    => 'add'
        );
        $this->ee->db->insert('actions', $data);
        return true;
    }
function uninstall()
    {
        $this->ee->load->dbforge();
$this->ee->db->where('module_name', $this->module_name);
        $this->ee->db->delete('modules');
$this->ee->db->where('class', $this->module_name);
        $this->ee->db->delete('actions');
return true;
    }
    function update($current = '')
    {
        return false;
    }
}
?>
----------------------------------------------------------------------------------------
2.mcp.article_statitics.php
ee =& get_instance();
        $this->ee->load->library('table');
        // some globals
        $this->base_url = base.amp.'c=addons_modules'.amp.'m=show_module_cp'.amp.'module=article_statistics';
         $menu    = array(                                       
            'module_index'            => array(   
                'link'  => $this->base_url,
                'tab_index'  => ,
                'title' => $this->ee->lang->line('module_index')
            ),
'test_list'    => array(
                'link'    => $this->base_url .amp. 'method=show_list',
                'tab_index'  => show_list,
                'title' => $this->ee->lang->line('show_list')
            )
        );
$this->cached_vars['module_menu']             = $menu;       
    }
public function index()
    {
        $this->_set_nav_title($this->ee->lang->line(article_statistics_module_name),$vars);
        return $this->ee->load->view('index', $vars, true);
    }
public function show_list()
    {
        $this->ee->load->library('article_statistics_helper');
$this->_set_nav_title($this->ee->lang->line(article_statistics_module_name),$data);
$sql=select *
                from bv_comments c
where unix_timestamp(date_sub(curdate(),interval 30 day))                 order by c.comment_date desc;
        $query=$this->ee->db->query($sql);
$data[results]=$query;
        return $this->ee->load->view('show_list', $data,true);
    }
function _set_nav_title($title='',&$data)
    {
        $this->ee->cp->set_variable('cp_page_title',$title);
        $data['module_menu']        = $this->cached_vars['module_menu'];
    }
//class end
}
?>
----------------------------------------------------------------------------------------
3.mod.article_statistics.php
具体实现一些tag和一些tag中的form提交的方法接受
ee =& get_instance();
    }
//用于对应upd 中的action
    function add()
    {
        $username= $this->ee->input->post(username);
        $password= $this->ee->input->post(password);
$msg_id= $this->ee->input->get(msg_id);
        echo $username;
        echo
password:;
        echo $password;
echo
msg_id:;
        echo $msg_id;
    }
/* end form */
}
?>
----------------------------------------------------------------------------------------
4.views/menu.html
在mcp中调用的可以互相切换的tab的显示样式
input->get(method);
?>
----------------------------------------------------------------------------------------
5.libraries/ article_statistics_helper.php
链接views,mcp
ee =& get_instance();
}
}
?>
补充:
1.如果需要获取action_id可以在mod.module_name.php中直接调用
$this->form_data['act']                        = $this->ee->functions->fetch_action_id('test', 'add');
 'action'        => ?act=.$this->form_data['act'].amp.msg_id=333,
2.如果需要在form中设置跳转,则需要设置redirect的相应跳转路径
摘自 任宝永--renbaoyong --商业价值
http://www.bkjia.com/phpjc/478411.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/478411.htmltecharticle1.upd.article_statistics.php ?php class article_statistics_upd { var $version = 1.0; var $module_name = article_statistics; function __construct() { $this-ee = get_instance(); } fu...
其它类似信息

推荐信息