Use Smarty to Control Value Display

Q

How to Use Smarty to Control Value Display?

✍: FYIcenter.com

A

If you want to use a single field to a complex data element, like a comma separated list, you can use smarty template to control how the value will be processed before sending it to display or download.

1. Create a new field type called "CSL".

2. Click "Displaying > View Field" tab on On its definition page. And enter the following smarty template.

{if $CONTEXTPAGE == "edit_submission"}
    {$VALUE}
{elseif $CONTEXTPAGE == "submission_listing"}
    {$VALUE}
{else}
    {$VALUE|replace:',':'
'} {/if}

The above smarty template tells Form Tools to display the field value as is without any changes on the edit sumission page and list submission page. But on the other pages, like exporting (reporting) pages, the value will be divided on the delimiter (,) and displayed as multiple lines.

 

⇒ Using Export Manager Module

⇐ Clone Phone Number Field Type

⇑ Using Custom Fields Module

⇑⇑ Form Tools - Frequently Asked Questions

2019-11-21, 857🔥, 0💬