Welcome Guest, Not a member yet? Register   Sign In
Best way to pass function from MY_Controller to Controller
#1

(This post was last modified: 01-27-2016, 01:50 PM by wolfgang1983.)

Hello I would like to know what the best way is to pass a function from MY_Controller to A Controller?

PHP Code:
<?php

class MY_Controller extends CI_Controller {

    protected 
$data = array();

    public function 
__construct() {
        
parent::__construct();
        
$this->load->model('design/model_layout');
        
$this->load->model('extension/model_module');

        
$this->column_left();
        
$this->column_right();
        
$this->content_top();
        
$this->content_bottom();
        
$this->footer();
        
$this->header();
    }

    public function 
content_top() {
        
    }



So I can do this on multiple controllers

PHP Code:
<?php

class Welcome extends MY_Controller {

    
//public $data = array();

    
public function __construct() {
        
parent::__construct();
        
$this->load->library('position');
    }

    public function 
index() {
        
$data['column_left'] = $this->column_left();
        
$data['column_right'] = $this->column_right();
        
$data['content_top'] = $this->content_top();
        
$data['content_bottom'] = $this->content_bottom();
        
$data['footer'] = $this->footer();
        
$data['header'] = $this->header();


        
$this->load->view('home'$data);
    }

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Best way to pass function from MY_Controller to Controller - by wolfgang1983 - 01-27-2016, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB