Welcome Guest, Not a member yet? Register   Sign In
Strange problem with $this->load->view
#12

[eluser]Dionysius[/eluser]
[quote author="coolfactor" date="1196329158"]Please paste your entire Articles index() function.

Also, do you have *any* redirects in that controller, anywhere?[/quote]

Code:
function index()
    {

        $sec_id = (int)$this->uri->segment(2);

        $start = (int)$this->uri->segment(3);

        if (!$sec_id) redirect('');

        $sec_type = (bool)$this->ArticlesModel->is_newstype($sec_id);

        if ($sec_type) {
            $this->load->library('pagination');


            $config['uri_segment'] = 3;
            $config['base_url']    = base_url() . 'articles/' . $sec_id;
            $query = $this->db->query('SELECT id FROM articles WHERE section_id = ' . $sec_id);
            $config['total_rows'] = $query->num_rows();
            $config['per_page'] = '10';
            $config['first_link'] = '<<';
            $config['last_link'] = '>>';

            $this->pagination->initialize($config);

            $data['links'] = $this->pagination->create_links();


            $data['articles'] = $this->ArticlesModel->get_articles($sec_id, $sec_type, $start, $config['per_page']);
        } else {

            $data['articles'] = $this->ArticlesModel->get_articles($sec_id, $sec_type);
        }


        if (!$data['articles']) redirect('');

        if (count($data['articles']) == 1) redirect('articles/view/' . $data['articles'][0]->id);

        $data['sec_type'] = $sec_type;
        $data['sec_id'] = $sec_id;

        $data['sections'] = $this->SectionsModel->get_all();

        foreach ($data['sections'] as $item) {
            if ($item->id == $sec_id) $data['title'] = $item->name;
        }

        $data['intro'] = $this->SectionsModel->get_intro($sec_id);

        $this->load->view('articles', $data);
    }

There are 3 redirect() calls. But they are not called when I go to URL articles/<number>


Messages In This Thread
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-27-2007, 02:54 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-27-2007, 03:30 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 12:03 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 01:44 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 02:17 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 05:15 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 08:47 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 10:39 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 11:55 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 09:32 PM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-28-2007, 09:39 PM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-29-2007, 02:41 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-29-2007, 03:09 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 11-29-2007, 03:45 AM
Strange problem with $this-&gt;load-&gt;view - by El Forum - 01-31-2008, 09:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB