JustGo adlı üyeden alıntı:
mesajı görüntüle
DjMuratHan adlı üyeden alıntı:
mesajı görüntüle
14
●1.058
sayfa yapısı söyLe (Router Kullanmadığını Düşünürsek Eğer)
<?php
//application/controller/uyeler.php
class Uyeler extends CI_Controller
{
public function __construct(){
parent::__construct();
$this->load->model('uye_model');
}
public function uyelistesi(){
$data['uyeler'] = $this->uye_model->uyecek();
$this->load->view('uyelistesi',$data);
}
}
//aplication/models/uye_model.php
class Uye_model extends CI_Model {
public function __construct(){
parent::__construct();
}
public function uyecek(){
$query = $this->db->get("uye_tablom");
return $query->result_array();
}
}
//application/view/uyelistesi.php
//.... html tagların..
foreach($uyeler as $uye){
echo $uye['adi']." - " .$uye['emaili'] ."Falan Filan İşte <br />";
}Sonra da URLdencontrollers/index.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Index extends CI_Controller {
//Default bilgiler
public $bilgiler = array(
"page" => "anasayfa",
"header" => "header",
"footer" => "footer",
"menu" => "menu",
"sidebar" => "sidebar",
);
public function index()
{
$bilgiler = $this->bilgiler;
$this->load->view('case',$bilgiler);
}
public function uyeol()
{
$bilgiler = $this->bilgiler;
$bilgiler["page"] = "uyeol";
$this->load->view('case',$bilgiler);
}
}
?>
views/case.php
<?php
$a = $this->db->query('SELECT * FROM settings');
$a = $a->row_array();
$this->load->view($header,$a);
$this->load->view($menu);
$this->load->view($page);
$this->load->view($sidebar);
$this->load->view($footer);
?>