Forum

Thread tagged as: Problem, CKEditor

Html created from wysiwyg (ckeditor) appears as plain text on list page

I have a list-detail page generated with the following code:

if (perch_get('s')) {
 // Detail mode
    perch_content_custom('Cases', array(
        'template' => 'case_template.html',
        'filter' => 'case_slug',
        'match' => 'eq',
        'value' => perch_get('s'),
        'count' => 1,
        'return-html' => true,
     ));
} else {
    // List mode
        perch_content_custom('Cases', array(
            'template' => 'case_list_template.html',
            'return-html' => true,
        ));
 }

On the detail page (case_template.html) I have the following line of code:

 <perch:content id="case_previewShortDescription" type="textarea" html="true" editor="ckeditor" label="Short Description" order="4"  required="true" />.

On the Perch Admin panel, I'm able to add some markup with the wysiwyg like some bold text. This bold text appears, as expected, in bold on the detail page. However, when I want to display the same text on the list page (case_list_template) with <perch:content id="case_previewShortDescription" type="textarea" html="true" />, I get to see <strong> tags on my page.

Detail page:

Lorem ipsum dolor sit amet (ipsum is bold)

List page:

Lorem <strong>ipsum</strong> dolor sit amet

Is there a way I can solve this problem? Thanks in advance

Yours sincerely, Thomas Timmermans

Head Office

Head Office 0 points

  • 4 years ago
Simon Clay

Simon Clay 127 points

Is there a reason you are using 'return-html' => true,?

If you remove it, does it solve the issue?

Does adding encode="false" to the listing template help? <perch:content id="case_previewShortDescription" type="textarea" html="true" encode="false" />

Drew McLellan

Drew McLellan 2638 points
Perch Support

Make sure you include html="true" whenever you use id="case_previewShortDescription"

Thank you very much! html="true" en Encode="false" fixed it!