/*
@ This is my config file
*/
/*
@This is my controller.
*/
class Data extends CI_Controller{
function __construct()
{
parent::__construct();
$this->load->library(‘piwik’);
$this->load->helper(‘piwik’);
}
public function show(){
$this->load->library('piwik');
$this->load->helper('piwik');
$visits = $this->piwik->actions('day', 10);
$unique = $this->piwik->unique_visitors('day', 10);
// Recommend using sometype of caching for this, example:
// $visits = $this->piwik->actions('day', 10);
// $unique = $this->piwik->unique_visitors('day', 10);
echo $visits;
foreach($visits as $date => $visit)
{
$date_arr = explode('-', $date);
$year = $date_arr[0];
$month = $date_arr[1];
$day = $date_arr[2];
$utc = mktime(date('h') + 1, NULL, NULL, $month, $day, $year) * 1000;
$flot_visits[] = '[' . $utc . ',' . $visit . ']';
$flot_unique[] = '[' . $utc . ',' . $unique[$date] . ']';
}
$data['visits'] = '[' . implode(',', $flot_visits) . ']';
$data['unique'] = '[' . implode(',', $flot_unique) . ']';
echo "<pre>";
print_r($data['visits']); //output: [][]
print_r($data['unique']); //output: [][]
}
}
//Issue: Return 0 results. Any help appreciated.