Can't load a view with a string variable?!

edited March 2014 in Bug Reports
Why does the top $this->load->view work with a string literal, but the bottom $this->load->view doesn't work with a variable whose value is the same as the string literal?

<!-- works --> <?php $this->load->view('_blocks/_listing/events.php')?> <!-- doesn't work --> <?php $listing_block = '_blocks/_listing/'.fuel_var('listing_type','').'.php'; ?> <?php $this->load->view($listing_block)?>

I get the following when I load the page with the listing layout that uses the above code:

Test Event 3
Test Event 4

An Error Was Encountered
Unable to locate the file: _blocks/_listing/events.php

I want to be able to use 1 layout and set the listing block to load from a variable on the page.

Comments

  • edited 4:11AM
    fuel_var() outputs not only the variable but also the inline editing comment code used. If you set the third parameter to FALSE, then it won't do that. Or you can simply just use $listing_type instead of fuel_var('listing_type')
Sign In or Register to comment.