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

http://www.getfuelcms.com/user_guide/modules/fuel/site_variables

Is pretty thin on info.

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

Comments

  • edited 12:43PM
    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 12:43PM
    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 12:43PM
    What's your $config['fuel_mode'] in your fuel/application/MY_fuel.php set to?
  • edited 12:43PM
    Its set to auto
  • edited 12:43PM
    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 12:43PM
    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 12:43PM
    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 12:43PM
    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 12:43PM
    Boomer! Works fine.
  • edited 12:43PM
    OK... I'll need to do some more local testing and then may add that to GitHub
Sign In or Register to comment.