Created
May 22, 2013 17:28
-
-
Save mpmont/5629325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Project extends CI_Controller { | |
public function __construct() | |
{ | |
parent::__construct(); | |
require_once APPPATH . 'presenters/project_presenter.php'; | |
$this->data['project_ptr'] = new project_presenter(); | |
$this->load->model('project_model', 'project'); | |
} | |
public function index( $product_id = null ) | |
{ | |
$this->data['product'] = $this->product->get( $product_id ); | |
$this->load->view('project', $this->data); | |
} | |
} | |
/* End of file project.php */ | |
/* Location: ./application/controllers/project.php */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// View | |
<?= $product_ptr->name( $product->name ) ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Project_presenter { | |
public function name( $name ) | |
{ | |
if ( !empty($name) ) | |
{ | |
return $name; | |
} | |
else | |
{ | |
return 'The project has no name!'; | |
} | |
} | |
} | |
/* End of file project_presenter.php */ | |
/* Location: ./application/presenters/project_presenter.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment