Welcome Guest, Not a member yet? Register   Sign In
Advice? How to Tag?
#4

[eluser]georgerobbo[/eluser]
Is there a better, cleaner method for selecting the ID from the variable $data['rand']

My controller is the following.
Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $data['title'] = "Home";
        
        $this->load->model('Category');
        
        $data['cat'] = $this->Category->list_category();
        $data['rand'] = $this->Post->get_random_single();
        $data['new'] = $this->Post->latest_submissions();

        foreach ($data['rand'] as $item): $postid = $item['ID']; endforeach;
        $data['tag'] = $this->Post->get_tags($postid);

        $this->load->view('meta', $data);
        $this->load->view('header', $data);
        $this->load->view('home', $data);
    }


Messages In This Thread
Advice? How to Tag? - by El Forum - 10-19-2009, 10:09 AM
Advice? How to Tag? - by El Forum - 10-19-2009, 11:22 AM
Advice? How to Tag? - by El Forum - 10-19-2009, 12:35 PM
Advice? How to Tag? - by El Forum - 10-19-2009, 12:36 PM
Advice? How to Tag? - by El Forum - 10-19-2009, 12:57 PM
Advice? How to Tag? - by El Forum - 10-19-2009, 01:04 PM
Advice? How to Tag? - by El Forum - 10-19-2009, 01:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB