Welcome Guest, Not a member yet? Register   Sign In
routes.php : how to share a (config) variable in routes.php and rest of the app
#1

[eluser]rip_pit[/eluser]
It seems to be a simple question but I can't find a flexible solution :

I would want to set a config var, that is accessible from within routes.php, but atm I'm not able to access no config[] variables from inside routes.

As a quick example, lets say that I would want :
(autoloaded) custom_config.php
Code:
$config['path1']='mypath1';

routes.php
Code:
$route[ $config['path1'] . '/(:any)'] = "new/path/$1";//does not work

any controllers:
Code:
if (segments(1) == config['path1'])
  //..do something
and so on with path2...

Do you know a way to retrieve a config var from inside routes.php ? all clues are welcome




Theme © iAndrew 2016 - Forum software by © MyBB