[eluser]Juan Velandia[/eluser]
Hello, I've already ask for help in this matter, but I couldn't hit the spot, so here I am again:
I'm sending a query directly from the controller to the view to make a list within a list like this:
placeholder 1
- section1
- section2
- section3
placeholder 2
- section4
- section5
- section
This is the controller:
Code:
function test(){
$data['query1'] = $this->db->get('cms_placeholder');
$data['query2'] = $this->db->get('cms_section_content');
$data['result2'] = $data['query2']->result();
$this->load->view('test', $data);
}
where cms_section_content has a column placeholder
Here's the view:
Code:
<?php foreach ($query1->result() as $row): ?>
<h1><?echo $row->name?></h1>
<? $placeholder = $row->placeholder; ?>
<?php foreach ($query2->result() as $row): ?>
<p><?echo $row->name?></p>
<?php endforeach; ?>
<?php endforeach; ?>
But I always get this: Message: Undefined variable: placeholder. I don’t want to pass variables via URL therefore I was thinking to put a query within the view to make the $placeholder available, but I’m sure there’s a more elegant solution, Thanks in advance for any idea!