View Single Post
Old 06-29-2009, 09:56 AM   #3 (permalink)
Hightower
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

Quote:
Originally Posted by Jim View Post
You can create a helper in the application/helper/ folder e.g. /application/helper/myfunction_helper.php (include _helper or it wont work), then you can either load the helper in each file using $this->load->helper('myfunction'); as you already know. But you can also autoload it by adding it to the helper autoload array in application/config/autoload.php
I've created a helper and autoloaded it for my project. To use the helper though I have to call the necessary function don't I? For instance:

PHP Code:
function index()
{
$data call_function_from_custom_helper();

$this->load->view('header',$data);

The thing is, this helper (or function) needs to be loaded on every page, and the returned values need to be used on every page in the header file. I don't want to have to type the above code into every function of every class (or even the construct function of every class) as this is tedious. There must be somewhere where I can type the above code once, and once only so every page in my app automatically has the data from the helper function.
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote