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

[eluser]razerone[/eluser]
Hi. Currently I am arraying some of my views but its to long I would like to be able to make a helper that would load the view in array so all I would have to do is $data = array (header); rather than $data = array (header => $this->load->view(theme/default/template/common/header.tpl)); that way is to long.

Here is what it looks like in my controller home.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

public function index() {

$this->children = array(
'header' => $this->load->view('theme/default/template/common/header.tpl'),
'column_left' => $this->load->view('theme/default/template/common/column_left.tpl'),
'column_right' =>  $this->load->view('theme/default/template/common/column_right.tpl'),
'content_top' => $this->load->view('theme/default/template/common/content_top.tpl'),
'content_bottom' => $this->load->view('theme/default/template/common/content_bottom.tpl'),
'footer' => $this->load->view('theme/default/template/common/footer.tpl')
);
$this->load->view('theme/default/template/common/home.tpl' , $this->children);
}
}

Would like to be able to do it this way just don't know how to word it in helper file. "template"

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

class Home extends CI_Controller {

public function index() {

$this->children = array(
'header',
'column_left',
'column_right',
'content_top',
'content_bottom,
'footer'
);
$this->load->view('theme/default/template/common/home.tpl' , $this->children);
}
}


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