Welcome Guest, Not a member yet? Register   Sign In
Problem with own config File
#1

[eluser]codeworxx[/eluser]
Hey Guys,

just started my first Project with CodeIgniter - a huge Webshop System.

Now i have my first Problem:
I have created my own Configuration File named 'shopconfig.php' in the 'application/config' folder and loaded by 'autoload'.

In this one i have declared
Code:
$config['shoptitle'] = 'Test';

For now i have created a Controller for my Home:

In this one i have
Code:
$data['sitetitle'] = $this->config->item( 'shoptitle' );
        $this->load->vars( $data );

In my view i have the $sitetitle between <title>.

Everything works.

Now my Question:

Is it possible to load all own config Variables automatically with EACH controller?

Or do i have to load them like
Code:
$data['sitetitle'] = $this->config->item( 'shoptitle' );

in every Controller for every Variable?

Hope you understand what i mean!

Thanks,
Sascha
codeworxx development
#2

[eluser]pistolPete[/eluser]
You can access all config variables using this array:
Code:
$this->config->config
#3

[eluser]codeworxx[/eluser]
perfect... thank you so much!
#4

[eluser]codeworxx[/eluser]
okay, for now... i was to fast with my reply Sad sorry!

do i have to use $this->config->config in the view files???

isn't there any better way to use eg. from $config['shopimages'] just $shopimages?
#5

[eluser]pistolPete[/eluser]
You could load the array as usual:
Code:
$this->load->vars( $this->config->config );
#6

[eluser]codeworxx[/eluser]
oh d**n... to early in the morning!!! Smile))

thanks for the fast help.

greetings from germany.




Theme © iAndrew 2016 - Forum software by © MyBB