Welcome Guest, Not a member yet? Register   Sign In
New to CI - stuck on news tutorial with an 'Undefined property' error
#4

[eluser]jimbojames[/eluser]
Hi TheFuzzyOne,

I'm sorry, maybe I was a bit hasty, but I was looking forward to learning a new framework and to then get an error on the tutorial, spend hours trying to resolve it with Google, finally throw the towel in and post in these forums and then no reply (at first), I was a bit disappointed.

Anyway, my controller code is the same at the tutorial from the CI site:

Code:
<?php

class News extends CI_Controller {
    
    public function __contruct()
    {
        parent::__construct();
        $this->load->model('news_model');
    }
    
    public function index()
    {  
        $data['news'] = $this->news_model->gets_news();
        $data['title'] = 'News archive';
        
        $this->load->view('templates/header', $data);
        $this->load->view('news/index', $data);
        $this->load->view('templates/footer');
    }
    
    public function view($slug)
    {
        $data['news'] = $this->news_model->gets_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/index', $data);
        $this->load->view('templates/footer');
    }
    
}

Can you see any errors?

I have since read that it looks as if Ellis Lab is going cold on CI and there is only 1 guy contributing at the moment. What's your thoughts?


Messages In This Thread
New to CI - stuck on news tutorial with an 'Undefined property' error - by El Forum - 05-19-2013, 11:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB