Welcome Guest, Not a member yet? Register   Sign In
problem with my template
#1

[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>
&lt;html&gt;
&lt;head&gt;
    &lt;meta charset="utf-8" /&gt;
    &lt;?php echo link_tag('css/fuel.css'); ?&gt;
&lt;title&gt;&lt;?php echo $title ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    <hr>
    <h2>&lt;?php echo ucfirst($title) ?&gt;</h2>
    <hr>

and I have a footer with som basic stuff.
oh yes and my template file under views:

Code:
&lt;?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


Messages In This Thread
problem with my template - by El Forum - 10-22-2013, 11:00 AM
problem with my template - by El Forum - 10-22-2013, 11:55 AM
problem with my template - by El Forum - 10-22-2013, 11:30 PM
problem with my template - by El Forum - 10-23-2013, 02:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB