Problems with Fuel text editor & modules

edited September 2012 in Modules
No problems with the blog formatting whatsoever, as long as I set the posts formats to 'Markdown'.

However I have created a couple of modules, and when I create an item in the CMS and try to use the mailto or image icons I just get
{safe_mailto("livvy@mac.com")}
showing up on the page, and images are broken. can't work out how to fix this!

Comments

  • edited 10:40PM
    Try adding the $parsed_fields class property to your model. It should be an array of the field names you want to parse. If you use the "_formatted" magic method, you should include that in the list as well. Example:
    public $parsed_fields = array('content', 'content_formatted');
  • edited 10:40PM
    That doesn't seem to work, I must be missing some logic somewhere..

    COntroller:
    <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Testimonials_model extends Base_module_model { public $required = array('name','content'); public $parsed_fields = array('content', 'content_formatted'); function __construct() { parent::__construct('testimonials'); }

    View:
    <? $CI->load->model('testimonials_model'); $testimonials = fuel_model('testimonials', array('find' => 'all', 'precedence desc')); ?> <div id="testimonials"> <?= fuel_edit('create', 'Add Testimonial', 'testimonials'); ?> <? if(!is_null($testimonials)) { // Sort by date, so newest show first foreach ($testimonials as $key => $row) { $date[$key] = $row['date']; } array_multisort($date, SORT_DESC, $testimonials); foreach($testimonials as $t) { ?> <hr/> <?= fuel_edit($t['id'], 'Edit Testimonial', 'testimonials'); ?> <h2>Name: <?= $t['name'] ?></h2> <h2><?= ($t['date'] != '0000-00-00') ? 'Date: ' . $t['date'] : '' ?></h2> <p><?= $t['content'] ?></p> <? } ?> <? } ?> </div>

    Each testimonial consists of name, content and date. 'content' is the field I am having issues with..

    Thanks
  • edited 10:40PM
    In order for it to work correctly, the records need to be an array of objects instead of an array of arrays. To make it an object, you must have a "Testimonial_model" (note no "s" after Testimonial) which extends Base_module_record. The class can be in the same file as the "Testimonials_model" class.
  • edited 10:40PM
    Thank you so much! That completely fixed everything
Sign In or Register to comment.