[eluser]raffie77[/eluser]
Hi people, i'm a newbe here :-)
I have created a template.
this is my conroler:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Fuel extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('html');
$this->load->library('table');
}
public function index() {
$this->welkom();
}
public function welcome(){
$data['title'] = 'welcome';
$data['main_content'] = 'welcome';
$this->load->view("template", $data);
}
public function image() {
$data['title'] = 'test';
$data['main_content'] = 'imagetest';
$this->load->view("template", $data);
}
public function overview() {
$data['title'] = 'overview';
$this->load->model('get_DB');
$data['main_content'] = $this->get_DB->overview() ;
$this->load->view("template", $data);
}
}
this is my model:
Code:
<?php
class Get_DB extends CI_Model
{
public function overview() {
$query = $this->db->query("SELECT * FROM invoer "
. "ORDER BY dateDESC");
$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1">' );
$this->table->set_template($tmpl);
echo $this->table->generate($query);
}
}
under views I have this header:
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<?php echo link_tag('css/fuel.css'); ?>
<title><?php echo $title ?></title>
</head>
<body>
<hr>
<h2><?php echo ucfirst($title) ?></h2>
<hr>
and I have a footer with som basic stuff.
oh yes and my template file under views:
Code:
<?php
$this->load->view('templates/header');
$this->load->view($main_content);
$this->load->view('templates/footer');
well the problem is this:
when I open index, welcome, and image, all goes well
but when I open overview, I get an error:
Quote:A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\application\models\get_DB.php:16)
Filename: core/Common.php
Line Number: 442
An Error Was Encountered
Unable to load the requested file: .php
btw C:\xampp\htdocs\test\application\models\get_DB.php:16 =
Code:
echo $this->table->generate($query);
anny idea what goes wrong?
Ralph