Welcome Guest, Not a member yet? Register   Sign In
header white Data
#1

Hello everybody,
I wanted to include a loop in my template header.php.
Unfortunately I get with the foreach an error message.
What have I done wrong?

Controller:
PHP Code:
<?php
    
class Warenkorb extends CI_Controller
        
{
            function 
__construct()
                {
                    
parent::__construct();
                }

            public function 
header()
                {
                    
$data['header_warenkorbs'] = $this->Warenkorb_model->header_warenkorbs();
                    
$this->load->view('templates/header'$data);
                    
// $this->load->view('test/index');
                    // $this->load->view('templates/footer');
                
}
        } 

Model:
PHP Code:
<?php
 ¬† ¬†class Warenkorb_model 
extends CI_Model
        
{
            public function 
header_warenkorbs()
                {
                    
$this->db->select('*');
                    
$this->db->from('db_artikel');
                    
$query $this->db->get();
                    return 
$query->result_array();
                }
        } 

header.php
Code:
<?php foreach ($header_warenkorbs as $warenkorb): ?>
                                <li>
                                    <span class="item">
                                        <span class="item-left">
                                            <span class="item-info">
                                                <span>Item name</span>
                                                <span>23$</span>
                                            </span>
                                        </span>
                                        <span class="item-right">
                                            <button class="btn btn-xs btn-danger pull-right">x</button>
                                        </span>
                                    </span>
                                </li>
<?php endforeach; ?>
Reply


Messages In This Thread
header white Data - by Germanikus - 10-13-2017, 11:39 AM
RE: header white Data - by InsiteFX - 10-13-2017, 03:28 PM
RE: header white Data - by Germanikus - 10-13-2017, 09:26 PM
RE: header white Data - by PaulD - 10-14-2017, 07:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB