Okay, so generally I wouldn't have a problem doing this and it would be fairly straight forward, but not so much this time.
Here is the relevant code in my controller:
// In order to properly build the form url, we need to include the
// category and product to the view
$this->data = array(
'category' => $category,
'product' => $product
);
// Load the product model and get editable values from the database
$this->load->model('productadmin/products_model');
$productInformation = $this->products_model->get_product_data($product);
// Modular code! Use variable-variables to prevent having to write multiple lines of code
// when we start returning more information from the data
foreach ( $productInformation as $variable => $value )
{
$this->data[$variable] = $value;
}
Now, ideally, I should be able to access $product, $category and any variables returned from the products model. Doing a print_r, I get the following:
Array ( [category] => 1 [product] => 1 [0] => Array ( [id] => 1 [product_name] => Duff ) )
Notice how what was generated by the foreach statement is contained in it's own array. The easiest solution, would be to know how to access that second array from the view, just by passing $this->data
.
If that's not do-able, what can I change that would assign the model's associative values inside the data array without creating another array inside of it?
The model simply returns key, value pairs from a get_where statement.