Welcome Guest, Not a member yet? Register   Sign In
Send config variable to index.php?
#1

[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
#2

[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.
#3

[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?
#4

[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";
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB