Jump to content

Recommended Posts

I wish Twig to escape all variables except for row.id and row.path, and not escape the quotes or anchor tabs around each.  Is this possible?  Thanks

<tr{{ (row.id?' data-id="'~row.id~'"')|raw }}><td>{{ row.path?'<a href="'~row.path~'" target="_blank">'|raw~row.name~'</a>'|raw:row.name }}</td><td>{{ row.size }}</td><td>{{ row.date }}</td><td><img alt="Delete File" title="Delete File" src="/lib/stdimages/icon_16/delete.png" class="vtip delete" height="16" width="16"></td></tr>
Edited by NotionCommotion

Thanks Jacques,  Yea, definitely not very readable using a ternary, and taking way too much time messing around with them.

 

EDIT.  I kept the single {{ (row.id?' data-id="'~row.id~'"')|raw }} as is as it was really simple, but change the rest to {% if %}, and it works perfect.  Thanks again.

Edited by NotionCommotion
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.