I have finally managed to get some kind of control panel area created, but cant figure out how to transfer my array over to the view page.
My aim is to create an array from the database, then display the value of that field in the view page.
mcp index function
public function index()
{
$this->EE->cp->set_variable('cp_page_title', $this->EE->lang->line('currency_module_name'));
$this->EE->load->helper('form');
$this->EE->load->library('table');
$this->EE->load->library('form_validation');
$query = $this->EE->db->query("SELECT * FROM exp_currency");
$data = array (
"usd" => $query->row('usd'),
"eur" => $query->row('eur'),
"gbp" => $query->row('gbp')
);
return $this->EE->load->view('add_currencies', $data, TRUE);
}
View file
<?=form_open()?>
<?php
$this->table->set_heading(
lang('USD'),
lang('EUR'),
lang('GBP')
);
$this->table->add_row(
form_input('usd', set_value('usd', $data['usd']), 'id="usd"'),
form_input('eur', set_value('eur', $data['eur']), 'id="eur"'),
form_input('gbp', set_value('gbp', $data['gbp']), 'id="gbp"')
);
echo $this->table->generate();
$this->table->clear();
?>
<input type="submit" class="submit" value="<?=lang('update_currencies')?>" />
<?=form_close()?>
If anyone can point me in the right direction, that would be great :)