Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Controller
- /////////////
- function index()
- {
- // Nested Views
- # Header Information
- $header_data['title'] = 'All Joboffers';
- $data['header'] = $this->load->view('mainpage/header_view',$header_data,TRUE);
- # Content Information
- $content_data = array(
- 'heading' => 'Our Job Offers',
- #'display_jobs' => $this->jobs_model->getJobs()
- $query = $this->jobs_model->getJobs()
- );
- # Load the View File
- $data['content'] = $this->load->view('jobs/index',$content_data,TRUE);
- # Load Mainpage
- $this->load->view('mainpage_view',$data);
- }
- // Model
- ////////
- function getJobs ()
- {
- $this->db->join('user_profile', 'jobs.author_id = user_profile.user_id');
- $this->db->limit(4);
- $this->db->order_by('jobs.id','DESC');
- $this->db->where('status','1');
- $query = $this->db->get('jobs');
- return $query->result_array();
- }
- // View
- ///////
- <?php
- /*$this->table->set_heading('City','Country', 'Company', 'Time');
- foreach($query->result_array() as $row):
- $this->table->add_row(
- '<a href="/jobs/detail/'. $row->id.'">'.$row->placeofwork.'</a>',
- '<a href="/jobs/detail/'. $row->id.'">'.$row->country.'</a>',
- '<a href="/jobs/detail/'. $row->id.'">'.$row->company_name.'</a>',
- '<a href="/jobs/detail/'. $row->id.'">Fulltime</a>'
- );
- endforeach;*/
- $fieldnames = array();
- foreach ($query as $val) {
- foreach ($val as $key => $value) {
- $fieldnames[] = $key;
- }
- }
- $this->table->set_heading(array_unique($fieldnames));
- $data['table'] = $this->table->generate($query);
- ?>
Add Comment
Please, Sign In to add comment