[eluser]Unknown[/eluser]
I am creating a simple forum using the CodeIgniter.
I want to get latest topic for each category in Forum Home Page.
It's OK for a category page to get latest topic, but I can't get for Home Page.
What i want is in Attachment Photo.
My Controller for Home Page Category List -
Code:
class Category extends CI_Controller {
public function index()
{
$this->load->model('Category_model');
$data['categories'] = $this->Category_model->get_all_categories();
$this->load->view('forums/index', $data);
}
}
My Model -
Code:
class Category_model extends CI_Model {
function get_all_categories()
{
$get_categories = $this->db->get('categories');
return $get_categories->result_array();
}
}
DB Structure-
Topics
topic_id
topic_title
topic_content
topic_cat_id
Categories
cat_id
cat_name
cat_description