Skip to content

Instantly share code, notes, and snippets.

@mpmont
Created May 22, 2013 17:28
Show Gist options
  • Save mpmont/5629325 to your computer and use it in GitHub Desktop.
Save mpmont/5629325 to your computer and use it in GitHub Desktop.
<?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 */
// View
<?= $product_ptr->name( $product->name ) ?>
<?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