Hello Guys
I’m starting to work with the MVC approach, but after some hours I’ve decided to ask for help, it’s a simple matter: I can’t get this example to work, could anyone take a look and give me some hints, thanks a lot. I’m trying to have a working example to understand the MVC architecture.
I’m just trying to get a list of records (logo names) from a table database: cms_proveedor
Controller:
<?php
class Logo_controller extends Controller {
var $data;
function Logo_controller(){
parent::Controller();
$this->load->model('logo_model');
}
function index(){
$this->data['logo'] = $this->?????->show_logo_all();
$this->load->view('logo_view', $this->data);
}
}
?>Model:
<?
class Logo_model extends Model {
function Logo_model(){
parent::Model();
}
function show_logo_all(){
$this->db->select('logo');
$query = $this->db->get('cms_proveedor');
$logos_array = array();
foreach ($query->result() as $row):;
$logos_array[] = $row[0];
endforeach;
return $logos_array;
}
}
?>View:
<? echo 'Logos Listado';?>
<? foreach ($logos_array as $row):?>
<h1><?echo $row->logo ?></h1>
<?php endforeach;?>Surely is all wrong, but i’m just starting..
thanks!