Welcome Guest, Not a member yet? Register   Sign In
controller class variables
#3

[eluser]WanWizard[/eluser]
You're defining local variables, not class variables:
Code:
<?php
class sim_audio_presets extends Controller {

    var $table; // add others here as needed

    function sim_audio_presets()
    {
        parent::Controller();    
        
        //load libraries and helpers
        $this->load->library('user_agent');
        $this->load->helper('socket');
        $this->load->helper('url');
        
        //Set Database Table
        $this->table = 'sim_audio_presets';
        
        //Set callback server
        $server = '************';
        $port = '****';
        
    }

function get()
    {
        
        
        $id = $this->uri->segment(3);

        $this->db->where('room_id', $id);
        $query = $this->db->get($this->table);
        
        foreach ($query->result() as $row)
        {
            $data[] = array('id'        => $row->id,
                            'room_id'    => $row->room_id,
                            'preset'    => $row->preset,
                            'name'        => $row->name);
        }
        
        $json = '{"'. $table .'":' . json_encode($data) . '}';
        $data['json'] = $json;
        
        $this->load->view('responder', $data);
    }


Messages In This Thread
controller class variables - by El Forum - 06-07-2010, 02:03 PM
controller class variables - by El Forum - 06-07-2010, 02:07 PM
controller class variables - by El Forum - 06-07-2010, 02:09 PM
controller class variables - by El Forum - 06-07-2010, 02:11 PM
controller class variables - by El Forum - 06-07-2010, 02:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB