CodeIgniter Forums
Send config variable to index.php? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Send config variable to index.php? (/thread-26775.html)



Send config variable to index.php? - El Forum - 01-22-2010

[eluser]spmckee[/eluser]
Greetings,

I am trying to implement a version switch and am running into issues.

In the index.php I am trying to change:

Code:
$application_folder .= "ver_1.0.1/app";
to
Code:
$application_folder .= "ver_".$app_version."/app";

I would like to pull the variable from a config file and I can do this almost everywhere else but the index.php is proving difficult. Any ideas?

Thanks,
SP


Send config variable to index.php? - El Forum - 01-22-2010

[eluser]Colin Williams[/eluser]
index.php is the very first thing to load. You could manually include the config file in index.php if you want.


Send config variable to index.php? - El Forum - 01-22-2010

[eluser]spmckee[/eluser]
Thanks Colin. That would work but the config file is in the "ver_".$app_version."/app/config" path, so it would never be able to find itself. This same variable would be reused to locate the correct version of the asset folder from my template, view file as well. Here's my layout:

sys_1.7.2
ver_1.0.1
--app
--assets
ver_1.0.2
--app
--assets

So basically it's a var that can be grabbed at any time from any controller or view. Am i going about this all wrong perhaps?


Send config variable to index.php? - El Forum - 01-22-2010

[eluser]danmontgomery[/eluser]
Just declare a constant at the very top of index.php

Code:
define('APP_VERSION', '1.0.1');

...

$application_folder .= "ver_" . APP_VERSION . "/app";



Send config variable to index.php? - El Forum - 01-22-2010

[eluser]spmckee[/eluser]
[quote author="noctrum" date="1264219782"]Just declare a constant at the very top of index.php

Code:
define('APP_VERSION', '1.0.1');

...

$application_folder .= "ver_" . APP_VERSION . "/app";
[/quote]

Brilliant! Thanks.