Jump to content

Recommended Posts

Posted

I'm trying to do a simple task of rendering pagetable fields. Everything works fine except it won't render HTML from one of those fields. Here is what I have set up.

I want to have a section where I can create custom list items (using a SVG for the bullet instead of the normal one). I created a text area field where I type in one line for each bullet point. I then have this rendered on the back end with all the other HTML included to give me my nice list. If I put HTML in any of the list items (like <strong></strong>) it doesn't not get rendered as HTML, just plain text. I would like it rendered as HTML.

The text area field has the HTML Entity Encoder set and the Markup/HTML option set (I've tried it with Unknown/Text as well). 

The code on the pagetable item rendering template is:

 <?php
 echo '<div class="grid grid-cols-2 gap-3 mt-6">';
 $array = preg_split("/[\n\r]+/", $page->pt_list);
 foreach ($array as $listitem){
  echo '<span class="list-none text-blue-600 ml-4 pl-10"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5 inline align-text-bottom   -ml-10 mr-4">
    <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /></svg>'.$listitem.'</span>';
 }
  echo '</div>';
?>

On the main template I am rendering the item with a simple 

<?php foreach($page->listsection as $section) echo $section->render(); ?>  

Does anyone have any ideas why the HTML would not be rendering correctly?

Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...