我正在尝试将其集成到我的 PHP 项目中:https ://github.com/bastianallgeier/gantti
我已将 calendar.php 和 gantii.php 复制到应用程序/库中。
控制器:
<?php
class summary extends CI_Controller {
function index() {
$this->load->library('gantti');
$gantti = new Gantti($data, array(
'title' => '',
'cellwidth' => 25,
'cellheight' => 35,
'today' => true
));
$this->load->view('summary_view', $gantti);
}
}
看法:
<?php
require('lib/gantti.php');
require('controllers/summary.php');
date_default_timezone_set('UTC');
setlocale(LC_ALL, 'en_US');
?>
<!DOCTYPE html>
<html>
<head>
<title>Summary</title>
<meta charset="utf-8" />
<link href="<?php echo base_url(); ?>assets/css/gantti.css" rel="stylesheet" media="screen">
<link href="<?php echo base_url(); ?>assets/css/metro-bootstrap.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery-1.10.2.js"></script>
</head>
<body>
<div class="page-header">
<h1>Summary</h1>
</div>
<?php echo $gantti ?>
</body>
</html>
但我没有查看页面,而是收到如下错误(404):
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Gantti::__construct(), called in C:\xampp\htdocs\wwww\system\core\Loader.php on line 1099 and defined
Filename: libraries/gantti.php
Line Number: 18
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: libraries/gantti.php
Line Number: 29
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/gantti.php
Line Number: 41
Fatal error: Call to a member function month() on a non-object in C:\xampp\htdocs\www\application\libraries\gantti.php on line 58