0

I read this pages:

And not work for me, I want a var for config, only read/set/print

I try to declare a single var in files: config.php and constant.php

$someVAR= 'somevalueUrlForHeader';

and try to print in view (header.php):

echo $someVAR;

and get this error

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: someVAR

Filename: template/header.php

Line Number: 15

Community
  • 1
  • 1
  • Can you tells us which modules you have installed? Use `apache2ctl -M` to see them. – Kristian Vitozev Jun 18 '15 at 17:07
  • 1
    There are ways to determine them on windows. You can find a list of the enabled ones in the httpd.conf (or apache.conf) configuration file. But I would recommend not doing so, as it is generally not that much worth it. Either an apache module is necessary, or it isn't that much of a slowdown. – Bert Peters Jun 18 '15 at 18:14
  • You tagged this as performance. If you want performance, you serve PHP using `PHP-FPM` and then apache or nginx are simply HTTP proxies towards that. The performance gain is huge so it's worth doing it. Removing modules and other silly optimizations that have no real impact are just a complete and total waste of your time. – Mjh Jun 19 '15 at 13:53

1 Answers1

0

set config variable as bellow.

$this->config->set_item('item_name', 'item_value');

get value of set variable as bellow.

$this->config->item('item name');

so in this way you can set global value of codeigniter and can be use any where in application.

for more info see on following url:

https://ellislab.com/codeigniter/user-guide/libraries/config.html

shankar kumar
  • 648
  • 5
  • 9