• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
include set of custom variables and array

#1
[eluser]LuckyFella73[/eluser]
Hello,

I want to set up file containing variables and arrays for example:
Code:
$clearGIF = '<img src="clear.gif" width="1" height="1" border ="0" alt="">'
which should be available in the view files.

In older versions of CI there was a script-folder and I loaded my "conf-file"
this way:
Code:
$this->load->script('formfields_'.get_class($this));

What is the best way to do this with CI 1.6.3 ? I didn't find a thread
about this (maybe it's because my english is not the best and I can't
figure out the right search term to find the right thread ...)

The own conf files don't have to be autoloaded, because I need different
ones in different controllers/ views

#2
[eluser]LuckyFella73[/eluser]
Just found in the userguide that it's possible to load this kind of files like:
Code:
$this->load->file('system/application/config/own_config.php', true);

my conf file now looks like:
Code:
$this->clearGIF  = '<img src="'.base_url().'clear.gif" width="1" height="1" border ="0" alt="">';

and in the view I can acess the vars like:
Code:
&lt;?php echo($this->clearGIF); ?&gt;

Just in case someone else has the same question ...


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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