Welcome Guest, Not a member yet? Register   Sign In
How to make custom helper work.
#13

[eluser]razerone[/eluser]
[quote author="InsiteFX" date="1390221886"]View:
Code:
$this->load->view('header');
$this->load->view('main');
$this->load->view('footer');

Controller:
Code:
// Setup $data array

$this->load->vars($data);    // global to all views
$this->load->view('template');
[/quote]

Here is way I am working on my controller home. Just need a function in a library or my_controller to make this work

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

class Home extends MY_Controller {

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

       public function index(){
  
  // Need It Setup Like This

  $data['column_left'] = $this->controllers->load('common/column_left');
  $data['column_right'] = $this->controllers->load('common/column_right');
  $data['content_top'] = $this->controllers->load('common/content_top');
  $data['content_bottom'] = $this->controllers->load('common/content_bottom');
  $data['footer'] = $this->controllers->load('common/footer');
  $data['header'] = $this->controllers->load('common/header');

  if ( ! file_exists('template/common/home.tpl')) {
      $this->load->view('template/common/home.tpl', $data);
  } else {
      $this->load->view('default/template/common/home.tpl', $data);
  }      
}
}

home.tpl

<-- Need to be able to echo like below in my home view

Code:
&lt;?php echo $header; ?&gt;&lt;?php echo $column_left; ?&gt;&lt;?php echo $column_right; ?&gt;
<div id="content">&lt;?php echo $content_top; ?&gt;
<h   none;">&lt;?php echo $heading_title; ?&gt;</h1>
&lt;?php echo $content_bottom; ?&gt;</div>
&lt;?php echo $footer; ?&gt;


Messages In This Thread
How to make custom helper work. - by El Forum - 01-19-2014, 07:22 AM
How to make custom helper work. - by El Forum - 01-19-2014, 08:41 AM
How to make custom helper work. - by El Forum - 01-19-2014, 08:53 AM
How to make custom helper work. - by El Forum - 01-19-2014, 10:26 AM
How to make custom helper work. - by El Forum - 01-19-2014, 10:08 PM
How to make custom helper work. - by El Forum - 01-20-2014, 02:37 AM
How to make custom helper work. - by El Forum - 01-20-2014, 02:58 AM
How to make custom helper work. - by El Forum - 01-20-2014, 03:22 AM
How to make custom helper work. - by El Forum - 01-20-2014, 03:38 AM
How to make custom helper work. - by El Forum - 01-20-2014, 03:55 AM
How to make custom helper work. - by El Forum - 01-20-2014, 04:13 AM
How to make custom helper work. - by El Forum - 01-20-2014, 05:44 AM
How to make custom helper work. - by El Forum - 01-20-2014, 06:21 AM
How to make custom helper work. - by El Forum - 01-20-2014, 08:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB