[eluser]Juan Velandia[/eluser]
Im 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
- section6
the query in the controller:
Code:
$data['query1'] = $this->db->get('cms_placeholder');
Code:
$data['query2'] = $this->db->where('idplaceholder',$idplaceholder);
$data['query2'] = $this->db->get('cms_section');
where the table cms_section has a column named idplaceholder, and here's the view:
Code:
<?php foreach ($query1->result() as $row): ?>
<h1><?echo $row->placeholder_name?></h1>
<? $idplaceholder = $row->idplaceholder; ?>
<?php foreach ($query2->result() as $row): ?>
<h1><?echo $row->section_name?></h1>
<?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!