php – CodeIgniter第三方类不加载

我正在尝试实现Dashboard小部件类(在这里找到: http://harpanet.com/programming/php/codeigniter/dashboard/index#installation),但是它给我错误无法加载请求的类

我已经尝试将这个类添加自动加载中,以及在我的控制器$this-> load-> library(‘dash’)中,但是这也给出了相同的错误.

我已经检查了dash.PHP,并发现下面的方法私有函数__example __(),但不能理解开发人员在评论中说什么.

class Dash
{
    private function __example__()
    {
        /*
         * This function is purely to show an example of a dashboard method to place
         * within your own controller.
         */

        // load third_party hArpanet dashboard library
        $this->load->add_package_path(APPPATH.'third_party/hArpanet/hDash/');
        $dash =& $this->load->library('dash');
        $this->load->remove_package_path(APPPATH.'third_party/hArpanet/hDash/');

        // configure dashboard widgets - format: type,src,title,cols,alt (for images)
        $dash->widgets = array(

                    array('type'=>'oop','src'=>'test_dash','title'=>'Test OOP Widget','cols'=>3),// if 'title' is set to FALSE,the title block is omitted entirely
                    // note: this is an 'html' widget but is being fed content from a local method
                    array('type'=>'html','src'=>self::test_method(),'title'=>false,array('type'=>'file','src'=>'saf_inv.htm','title'=>'Safety Investigation'),// multi-content widget - set widget title in outer array (also note use of CI anchor to create a link)
                    array('title'=>anchor('tz','TARGET ZERO'),// sub-content follows same array format as single content widget
                            // 'img' content can also have an 'alt' text
                            array('type'=>'img','src'=>'saf_tzout.gif','alt'=>'Action Completed'),'src'=>'saf_tz.htm'),'src'=>'ave_close.htm','title'=>'Average Time to Close')
                            ),'src'=>'saf_meet.htm','title'=>'Safety Meeting'),'src'=>'saf_acc.htm','title'=>'Accident Investigation'),'src'=>'saf_hazmat.htm','title'=>anchor('hazmat','HAZMAT')),'src'=>'saf_cont.htm','title'=>'Loss of Containment'),'src'=>'saf_worksinfo.htm','title'=>'Works Information'),// an action widget - 'clear' will generate a blank widget with a style of clear:both
                    array('type'=>'clear'),// multi-content widget - width can be set using the 'cols' param in outer array
                    array('title'=>'RAG Report','cols' => 2,'src'=>'saf_rag.htm'),array('type'=>'img','src'=>'ProcSaf.gif')),'src'=>'saf_chrom.htm','title'=>'Chrome checks'),);

        // populate the view variable
        $widgets = $dash->build('safety');

        // render the dashboard
        $this->load->view('layout_default',$widgets);

    }
...................

} // end of Dash class

安装路径是root / application / third_party / hArpanet / hDash / libraries / dash.PHP

如何将此类加载到我的系统并使用小部件?

您必须创建一个初始化第三方类的库:

例如:

–in库创建一个名为mydash.PHP文件

<?PHP if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MyDash
{
    public function __construct()
    {
        require_once APPPATH.'third_party/hArpanet/hDash/libraries/dash.PHP';
    }
}

加载库使用:

$this->load->library('mydash');

那么你可以使用Dash类.还可以在自动加载中加载库.

谢谢…

相关文章

Hessian开源的远程通讯,采用二进制 RPC的协议,基于 HTTP 传输。可以实现PHP调用Java,Python,C#等多语...
初识Mongodb的一些总结,在Mac Os X下真实搭建mongodb环境,以及分享个Mongodb管理工具,学习期间一些总结...
边看边操作,这样才能记得牢,实践是检验真理的唯一标准.光看不练假把式,光练不看傻把式,边看边练真把式....
在php中,结果输出一共有两种方式:echo和print,下面将对两种方式做一个比较。 echo与print的区别: (...
在安装好wampServer后,一直没有使用phpMyAdmin,今天用了一下,phpMyAdmin显示错误:The mbstring exte...
变量是用于存储数据的容器,与代数相似,可以给变量赋予某个确定的值(例如:$x=3)或者是赋予其它的变...