Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

beginner question: fuel_var on homepage

edited November 2011 in Installation

I created a site variable in the admin area for my twitter handle which is called "twitter". I'm trying to call it on my homepage in the footer block using <?=fuel_var('twitter')?> but nothing happens. Am I missing something?


  • edited 10:49PM
    How is the page being rendered... meaning is it a page created in the admin, a static view file (no controller), or a controller/view?
  • edited 10:49PM
    Controller / View. I'm bringing over a old CI site. Below is my controller.


    class Home extends CI_Controller{

    function __construct(){

    function Home()

    public function index()
    $vars = array('' => '');

    $this->load->module_library(FUEL_FOLDER, 'fuel_page', array('location' => 'home'));

  • edited 10:49PM
    Hmm... I tested this locally and am not able to replicate the problem (was able to see the merged in value). What happens if you just use:
  • edited 10:49PM
    No luck...I get the undefined variable error.

    In my Site Variables, I have the variable called 'twitter' which is active and no scope.

    BUT when I add "$vars['twitter'] = '@me';" to _variables/global.php, it works.

    Could it not be looking at the DB for this information? Is there a setting where I can change where Fuel looks?
  • edited 10:49PM
    What do you have the $config['fuel_mode'] set to in you MY_fuel.php file?
  • edited 10:49PM
    Great! Set it to auto since my page content will most likely be from view files but I want to manage my global vars in the admin area.

    Love the CMS, thanks for all your help!
  • edited 10:49PM
    So that did the trick?
  • edited 10:49PM
    yes, thanks.
  • edited 10:49PM
    I am trying to do this same thing and am experiencing the same problem this thread originally voiced in that I am not seeing the value displayed on the view using the fuel_var function. I have my fuel_mode set to auto, but I have not added anything additional to the _variables/global.php file as mentioned above by ok1ha.

    What I want to do is quite simple. I have a Site Variable with a name of "Annual Gift Certificate Price" stored in Fuel with a value of 60. Plain and simple, it just stores a number.

    In my view file I have this:

    <?=fuel_var('Annual Gift Certificate Price')?>

    I'm using the controller method to render the view file, so this is not a fuel page I am trying to load. Also, if it helps, I am doing all of this from a custom module I created called "store".

  • edited 10:49PM
    Try changing the site variable name to something like 'annual_gift_certificate_price' without any spaces. Also, you should be able to just do a regular merge without fuel_var like so to just test the variables existence in the view:
Sign In or Register to comment.