fuel_var oddity

edited February 2011 in News & Announcements
I'm using the body_class layout variable, and it shows up fine. But when I need to check what it is, something odd happens when checking for equality. Say I set the body_class to 'index', and when I echo it, it says 'index', but a var_dump() says it has 28 characters instead of 5.

So when I do this:

$body_class = fuel_var('body_class');
if( $body_class == 'index' )

it doesn't return TRUE. I ran the result through md5:

echo md5( $body_class );
echo md5('index');

and I get this:

136784d76fecc9ba7f49fd9da90d3005
6a992d5529f459a44fee58c733255e86

Should I do something with the values that fuel_var() returns? Thanks!

Comments

  • edited 12:24PM
    fuel_var() actually returns the value as well as code that is used for inline editing (look around line 470 of in fuel/modules/fuel/helpers/fuel_helper.php). If you want to do comparisons, you can just use the normal variable $body_class.
  • edited 12:24PM
    doh >< thanks for the help!
  • edited 12:24PM
    Wow, just spent over an hour trying to figure that out... Thanks! :)
    Too bad that wasn't a comment with the $fuel_var doc page.
Sign In or Register to comment.