Welcome Guest, Not a member yet? Register   Sign In
Problem with the news tutorial
#1

[eluser]vYN[/eluser]
Hi. I'm new to CI. My problem is that news page is blank. No text at all. Nothing.

I will post my news controller.(ask me if you need more.)

Code:
<?php
class News extends CI_Controller {
    



     function __construct(){
        
         parent::__contruct();
        
         $this->load->model('news_model');
     }
    
    function index(){
        $this->load->model('news_model');
     $data['news'] = $this->news_model->get_news();
     $data['title'] = 'News archive';
    
     $this->load->view('templates/header', $data);
     $this->load->view('news/index', $data);
     $this->load->view('templates/footer');
    }
    
    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');
    }
    
    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', $data);
            $this->load->view('templates/footer', $data);
        }
        else
        {
            $this->news_model->set_news();
            $this->load->views('news/success');
        }
    }
}


Messages In This Thread
Problem with the news tutorial - by El Forum - 03-21-2012, 04:00 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 05:53 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 06:37 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 06:56 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 07:05 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 07:13 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 07:20 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 07:27 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 07:28 PM
Problem with the news tutorial - by El Forum - 03-21-2012, 10:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB