• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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 =)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.