[eluser]Juan Velandia[/eluser]
Hello Every one
I've dealing with this for a while, I hope you can put me on the right track, I need to show some data from DB on different menus according with the "placeholder" field in the "cms_section" table, here is the code so far:
model:
Code:
function show_item_placeholder($placeholder)
{
$this->db->select('name');
$this->db->select('url_section');
$this->db->where('placeholder',$placeholder);
$query = $this->db->get('cms_section');
return $query->result();
}
Controller:
Code:
function index($placeholder)
{
$data['section_content'] = $this->section_content_model->get_section_content();
$data['item_placeholder'] = $this->item_placeholder_model->show_item_placeholder($placeholder);
$partials = array('top_logo'=>'view_top_logo','top_menu'=>'view_top_menu', 'left_menu'=>'view_left_menu');
$this->template->load('master_home', $partials, $data);
}
and the view: "top_menu.php"
Code:
$placeholder = '1';
foreach ($item_placeholder as $row1):
echo anchor('home/section/'.$row1->url_section, $row1->name, array('class'=>'menuh1'))
endforeach;
Any ideas would be highly appreciated, thanks!