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.

Site Variables

edited December 2010 in Bug Reports
I created a site variable in the admin with the name of side_stats and an empty scope. I'm trying to pull that value through to a block (view/_blocks) with:

<?=fuel_var('side_stats', 'kaw kaw')?>

But I'm getting 'kaw kaw' instead. Am I missing something? Do I need something in views/_variables to make it work?

Value is stored in the DB okay..

Is pretty thin on info.

And a tiny catch: ({fuel_var('varname')} = mismatched braces on that UG page.


  • edited 9:09PM
    Is the page being rendered by a controller you created, or are you just using a view file that maps to a URI?

    Thanks for the UG catch... I'll update.
  • edited 9:09PM
    Mapped view file. But a block. I've created no controllers for this.

    So in a 'home' view I use:
    <?php $this->load->view('_blocks/side_bar')?>

    To load a block. To use the site variable In the side_bar I have:

    <?=fuel_var('side_stats', 'kaw kaw')?>
  • edited 9:09PM
    What's your $config['fuel_mode'] in your fuel/application/MY_fuel.php set to?
  • edited 9:09PM
    Its set to auto
  • edited 9:09PM
    Hmm... I'm not able to replicate the issue yet. What happens on a raw download of FUEL, set up with your existing db information and merging in the variable like above on say the header block that comes with the FUEL download?
  • edited 9:09PM
    Ugh, works now.. Can only assume it was a cache issue. Pages aren't cached in the admin and I also logged out just to check that.

    Thanks for checking and sorry to waste your time!
  • edited 9:09PM
    When you asked about it being in a controller I wrote, why is that? I have the same bar on a page that is using the blog module and on that page it doesn't work. It's now fine on all the admin-made pages.
  • edited 9:09PM
    Ahh... the blog module handles it's variables a little differently in it's controllers. You may be able to get that to work in the blog if you change the following line in the fuel/modules/blog/libraries/Base_blog_controller.php line 34 from:
    $_vars = $this->fuel_pagevars->view_variables(uri_path(), 'blog');

    TO something like:

    $_vars = $this->fuel_pagevars->retrieve(uri_path());

    Let me know if that works.
  • edited 9:09PM
    Boomer! Works fine.
  • edited 9:09PM
    OK... I'll need to do some more local testing and then may add that to GitHub
Sign In or Register to comment.