/** * View an event * * Route: /events/view/{id} */ public function view($id) { $this->load->library('markdown'); $data['id'] = $id; $data['event'] = new Event($id); // Check whether you're signed up for the event already $signup = new Signup(); $signup->where('user_id', $this->session->userdata('id')); $signup->where('event_id', $id); $signup->get(); if ($signup->exists()) { $data['signedup'] = true; } else { $data['signedup'] = false; } // Get all of the people who are signed up $signups = new Signup(); $signups->where('event_id', $id); $signups->get(); $data['signups'] = $signups; // Create the view $this->template->title = $data['event']->name; $this->template->content->view('events/view', $data); $this->template->publish(); }