Rendering a block from

edited March 2014 in News & Announcements
I don't know if this is at all possible...

I would like to call a block file when outputting the contents of a text field from the database.

Let me explain further... I have a SERVICES (model) module that stores different service descriptions, using among others a TITLE varchar field and DESCRIPTION text field. I would like to be able to store templating code (ex.: {fuel_block('slider')} in the text field and have the the code call the block when I output text field's content to my page (as it would If I had inserted the template code into the pages module body field.

Is this in anyway possible? Just echoing out the content of DESCRIPTION displays the templating code, nothing is actually rendered.

Thanks for any help.

Comments

  • edited 12:08PM
    There is a $parsed_fields property on models you can use to specify fields you want parsed automatically (including derived field names or "formatter" field names).
    $parsed_fields = array('description', 'description_formatted');
  • edited 12:08PM
    Awesome! Works like a charm.

    I missed it in the documentation, sorry. As always, thanks for your quick reply and help David.
Sign In or Register to comment.