suneditor icon indicating copy to clipboard operation
suneditor copied to clipboard

Display table with Smarty template

Open monkeydev001 opened this issue 1 year ago • 0 comments

I use suneditor for create email templates and also use Smarty to display data in future

In Code View mode I paste a template (part of the template):

<table class="se-table-layout-auto">
  <thead>
    <tr>
      <th style="width:300px;">
        <div>Product name</div>
      </th>
      <th style="width:100px;">
        <div>Quantity</div>
      </th>
      <th style="width:100px;">
        <div>Total</div>
      </th>
    </tr>
  </thead>
  <body>
   {foreach $order_products as $product}
    <tr>
      <td style="width:300px;">
        <div>{$product.product_name}</div>
      </td>
      <td style="width:100px;">
        <div style="text-align: center;">{$product.quantity}</div>
      </td>
      <td style="width:100px;">
        <div style="text-align: center;">${$product.total_amount}</div>
      </td>
    </tr>
  {/foreach}
  </tbody>
</table>

I switched to HTML => Code View and had trouble:

{foreach $order_products as $product}          {/foreach}    
  <table class="se-table-layout-auto">
    <thead>
      <tr>
        <th style="width:300px;">
          <div>Product name</div>
        </th>
        <th style="width:100px;">
          <div>Quantity</div>
        </th>
        <th style="width:100px;">
          <div>Total</div>
        </th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="width:300px;">
          <div>{$product.product_name}</div>
        </td>
        <td style="width:100px;">
          <div style="text-align: center;">{$product.quantity}</div>
        </td>
        <td style="width:100px;">
          <div style="text-align: center;">${$product.total_amount}</div>
        </td>
      </tr>
    </tbody>
  </table>

Expected behaviour Smarty code is not removed from templates in the table, as I understand used some function to check the HTML structure of a table and the code moved upper.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browsers: chrome, firefox

monkeydev001 avatar Sep 22 '23 15:09 monkeydev001