Data from model is not being parsed

edited May 2014 in Bug Reports
Hi,

I have templating code inserted into a field in one of my models - "PRODUCTS". The $parsed_fields array property is set in my "products_model" file like so:
public $parsed_fields = array('spec_fr','spec_fr_formatted');

However, the templating code that is saved in the "spec_fr" field, for example
{fuel_block('test')}
or
{img_path(schema6500P.jpg)}
is outputted as is, unparsed, in the front end.

I can't find an error anywhere. This site is using the 1.06 version of Fuel. The same code setup works in another site on the same server running on Fuel 1.03. Any ideas?

Comments

  • edited 11:03AM
    Is it just being outputted normally in your view file:
    <?=$record->spec_fr?>
    If so, is spec_fr overwritten in the record model at all and I'm assuming it's inheriting from the Base_module_record class correct?
  • edited May 2014
    It is being echoed in the view file, inside a foreach loop:
    <?php foreach ($products as $product) : ?> ... <?php echo $product['schema_fr']; ?> ... <?php endforeach; ?>

    $products is being passed to the view as a global variable like so:
    $CI->load->model('products_model'); $vars ['products'] = $CI->products_model->get_all_products();

    I'm not doing anything at the record level in the model and I am extending the base_module classes (model and record).
  • edited 11:03AM
    It's because it's an array syntax instead of an object. Try returning record objects instead of arrays and use echo $product->schema_fr
  • edited 11:03AM
    That worked, thanks.
Sign In or Register to comment.