[eluser]blinger2008[/eluser]
I have a list of projects displayed, and when you click on one, i want it to display the sub projects in that category. i have this code:
Code:
//model
function get_record($id){
$this->db->where('category',$id);
$query = $this->db->get('projects_inner');
return $query->result();
}
//controller
function category(){
$data = array();
if($this->uri->segment(3)) {
$data['records'] =$this->project_model->get_record($this->uri->segment(3));
} else {
if($query = $this->project_model->get_record()){
$data['records'] = $query;
}
}
$this->masterpage->addContentPage('head/default', 'head');
$this->masterpage->addContentPage('content/project_category', 'content', $data);
$this->masterpage->show();
}
//view
<table class="projects"><tr>
<?php if(isset($records)) : foreach($records as $row) :?>
<td><a >category); ?>"><img >projectImageUrl);?>" /></a><br/>
<strong><?php echo $row->category; ?>
<?php $is_logged_in = $this->session->userdata('is_logged_in');
if(!isset($is_logged_in) || $is_logged_in != false)
{
echo anchor("index.php/projects/delete/$row->id", 'x',array('class'=>'delete'));
?>
<?php
}
?>
</strong></td>
</tr>
<?php endforeach; ?>
</table>