Welcome Guest, Not a member yet? Register   Sign In
Load controller from another controller

(This post was last modified: 06-21-2019, 03:06 AM by hc-innov.)

You can do that (but I think library and real MY_controller are better):
I Have a directory 'application/font_controller' with a file called Font

PHP Code:
//$object is the oject of my controller
class Front {

   public function __construct() {
       //Do what you want
function footer($object) {
function header($object) {
       $object->data['header'] = 'My header';
function page($object) {
//Example: you can load everything with $object

My controller

PHP Code:
include_once (__DIR__.'/../Front_controller/Front.php');

Com extends CI_Controller {
   public $data;
function __construct() {
function index() {
       $this->data['footer'] = 'My footer';
       $front = new Front();


Messages In This Thread
RE: Load controller from another controller - by hc-innov - 06-21-2019, 02:52 AM

Theme © iAndrew 2016 - Forum software by © MyBB