fail to use config in routs.php

edited September 2014 in Modules
i am trying to access some global setting for the fuel module, so i did

$site_lang=$this->fuel->config('site_lang');

but fail to work saying not defined

Comments

  • edited 8:52PM
    Where is site_lang defined (what file)?
  • edited 8:52PM
    i defined in my_fuel.php, $config['site_lang']="en", putting in my_fuel.php, allow i switch on setting module at the back to allow user to set the language.
  • edited 8:52PM
    Where are you calling "$this->fuel->config('site_lang');" and is $this referencing the $CI object. To test an alternative you can use CI()->fuel->config('site_lang'). The CI function is a wrapper around the get_instance() function.
  • edited 8:52PM
    i am calling this in routes.php
  • edited 8:52PM
    The $CI object has not been created at that point in the process. The routes are used to determine which controller to use and the controller is essentially the $CI object ($this).
  • edited September 2014
    Call to undefined function CI() in /Applications/XAMPP/xamppfiles/htdocs/cms/fuel/application/config/routes.php on line 41, i believe CI instance is not even loaded?
  • edited 8:52PM
    That is correct. Not much has been loaded at this point including the $CI object. You may have to do a normal include of the file and reference it via $config['site_lang']
  • edited 8:52PM
    is there a defined variable directly goes to application folder. i know there is FUEL_PATH to fuel folder, but how about application folder.
  • edited 8:52PM
    CI defines a constant in the index.php bootstrap as APPPATH.
Sign In or Register to comment.