Welcome Guest, Not a member yet? Register   Sign In
how can i use data from custom config in custom helper file
#1

[eluser]DanTyan[/eluser]
Hello

i need to use data from custom config in my helper file, is anybody know how i can do it?

now my code looks like this:
Code:
$this->config->load('compass');
$this->load->helper('design');

and in helper i need
Code:
function image($sImageName)
{
    return base_url() . $this->config->item('images', 'design') . $sImageName;
}

any ideas?
#2

[eluser]gon[/eluser]
You must get a reference to the CI object.

Code:
function image($sImageName)
{
    $CI =& get_instance();
    return base_url() . $CI->config->item('images', 'design') . $sImageName;
}

the same thing occurs in libraries and models.

cheers.
#3

[eluser]DanTyan[/eluser]
great!!!! thanks =)




Theme © iAndrew 2016 - Forum software by © MyBB