CodeIgniter Forums
[Free Css Templates] combination of menu and the sidebar does not work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: [Free Css Templates] combination of menu and the sidebar does not work (/thread-51258.html)



[Free Css Templates] combination of menu and the sidebar does not work - El Forum - 04-26-2012

[eluser]d1d1[/eluser]
Night All
Ples Help me, i newbe this Code Igniter

i'm try Combination Free Css Templates n Code Igniter
but this MENU and Sidebar does not work, because i don't understand script for this menu and Sidebar.!

i Have THis File from
- root Dir = foler CSS and Images
- Aplication/controller/news.php
Code:
<?php
class News extends CI_Controller {

public function __Construct()
{
  parent::__construct();
  $this->load->model('news_model');
}

public function index()
{
  $data['news'] = $this->news_model->get_news();
  $data['title'] = 'Web Go Blog';
  
  $this->load->view('templates/header',$data);
  $this->load->view('news/index',$data);
  $this->load->view('templates/sidebar');
  $this->load->view('templates/footer');
}

public function view($slug)
{
$data['news_item'] = $this->news_model->get_news($slug);

if (empty($data['news_item']))
{
  show_404();
}

$data['title'] = $data['news_item']['title'];

$this->load->view('templates/header', $data);
$this->load->view('news/view', $data);
$this->load->view('templates/footer');
}

public function create()
{
$this->load->helper('form');
$this->load->library('form_validation');

$data['title'] = 'Create a news item';

$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('text', 'text', 'required');

if ($this->form_validation->run() === FALSE)
{
  $this->load->view('templates/header', $data);
  $this->load->view('news/create');
  $this->load->view('templates/footer');
  
}
else
{
  $this->news_model->set_news();
  $this->load->view('news/success');
}
}

}



[Free Css Templates] combination of menu and the sidebar does not work - El Forum - 04-26-2012

[eluser]d1d1[/eluser]
- Aplication/controller/pages.php
Code:
<?php
class Pages extends CI_Controller{
public function view($page = 'home')
{
  if(!file_exists('application/views/pages/'.$page.'.php'))
  {
    //up.. tidak ada halaman yang anda minta!
    show_404();
  }
  
  $data['title'] = ucfirst($page); //dek taok kenen
  
  //$this->load->view('pages/home');
  $this->load->view('templates/header',$data);
  $this->load->view('pages/'.$page,$data);
  $this->load->view('templates/footer',$data);
}


}

- Aplication/models/news_model.php
Code:
<?php
class News_model extends CI_Model {

public function __construct()
{
  $this->load->database();
}

public function get_news($slug = FALSE)
{
  if($slug === FALSE)
  {
   $query = $this->db->get('news');
   return $query->result_array();
  }
  
  $query = $this->db->get_where('news', array('slug' => $slug));
  return $query->row_array();
}

public function set_news()
{
$this->load->helper('url');

$slug = url_title($this->input->post('title'), 'dash', TRUE);

$data = array(
  'title' => $this->input->post('title'),
  'slug' => $slug,
  'text' => $this->input->post('text')
);

return $this->db->insert('news', $data);
}
}



[Free Css Templates] combination of menu and the sidebar does not work - El Forum - 04-26-2012

[eluser]d1d1[/eluser]
- aplication/views/templates/header.php
sorry i can not posting file header.php

but this image
Code:
http://a3.sphotos.ak.fbcdn.net/hphotos-ak-ash4/s720x720/306289_3020860249625_1506249433_2066677_1668959750_n.jpg