Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the controller


We're going to create only one controller in this project, which is /path/to/codeigniter/application/controllers/jobs.php.

There is only one controller in this project, so let's go over it now. We will look at the code and discuss how it functions.

There are three main functions in this controller, and these are as follows:

  • index(): This displays the initial list of job adverts to the user. It also displays the search box and displays any results that might be returned.

  • create(): This displays a form to the any user, allowing the users create a job advert.

  • apply(): This is accessed if the user clicks on the Apply button or the job title.

Create the /path/to/codeigniter/application/controllers/jobs.php file and add the following code to it:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Jobs extends MY_Controller {
  function __construct() {
  parent::__construct();
    $this->load->helper('string');
    $this->load->helper...