[eluser]ranggadablues[/eluser]
Hi there, I'm new in codeigniter and I'm sorry if my english not so good..
I have a website that left panel and right panel, on left panel I use for menu and right panel I use for product detail. And my menu I use database, because I want that my web have a dynamic menu, but I don't know how to implement in codeigniter when I click one of the left panel menu and right panel is showing from menu that I was click
here's my script:
model
Code:
function show_all_produk() {
$this->db->select('*');
$this->db->from('product');
$this->db->where('show_all','1');
$this->db->order_by('produk_id','ASC');
$produk = $this->db->get();
return $produk->result();
}
function load_menu() {
$this->load->database();
$menu = $this->db->query('select nama_menu from menu');
return $menu->result();
controller
Code:
function store()
{
$data['produk'] = $this->Pgallery_model->show_all_produk();
/*daftar menu*/
$data['menu'] = $this->Pgallery_model->load_menu();
$this->load->view('store', $data);
}
and my view
Code:
<!-- left panel -->
<div id="leftmenu">
<ul id="navigation">
<?php if (isset($menu) && count($menu)):
foreach($menu as $menus): ?>
<li><a id="link" href="#"><?php echo $menus->nama_menu; ?></a></li>
<?php endforeach; else:
endif; ?>
</ul>
</div>
<!-- end left panel -->
<!-- right panel -->
<div id="rightpanel">
<ul>
<?php if (isset($produk) && count($produk)):
foreach($produk as $row): ?>
<div id="product">
<div class="boxgrid captionfull">
<li><img src="<?php echo $row->imageurl; ?>" />
<div class="cover boxcaption">
<h3>Nama Produk</h3><br/>
<p><a href="#">Lihat detail</a></p>
</div>
<div><?php echo $row->nama; ?></div>
</li>
</div>
</div>
<?php endforeach; else: endif; ?>
</ul>
</div>
<!-- end right panel -->
please advice?
thank you