Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
SeanJ66 Posted February 27, 2020 Posted February 27, 2020 Hi all I'm currently building a database and setting up the fields. Right now the values from a checkbox set field get displayed on the same line on the display template, separated by commas. How do I get each value from the checkbox set to be displayed on one line or rather how could I give each value a tag so I can manipulate it with css accordingly?
bfarber Posted February 27, 2020 Posted February 27, 2020 If you edit the field in the AdminCP, on the second tab there are options to provide custom listing and display page formats. You would leverage this to customize how the value is output.
SeanJ66 Posted February 28, 2020 Author Posted February 28, 2020 18 hours ago, bfarber said: If you edit the field in the AdminCP, on the second tab there are options to provide custom listing and display page formats. You would leverage this to customize how the value is output. Thanks @bfarber have been using that and am aware of that. When I set the Display View Format to custom and use the {$value} tag it outputs all the checkbox set values in a string separated by commas. I want each value to be either placed into a bullet list or I just want each value to be given a span tag so I can style it into a list. Is there a relatively simple way of doing this or does it require complex coding?
bfarber Posted February 28, 2020 Posted February 28, 2020 I've not gone in and played around with this, but something like this should probably work: {{if $results = explode( ',', $value )}} {{foreach $results as $item}} <li>{expression="trim($item)"}</li> {{endforeach}} {{endif}}
SeanJ66 Posted March 10, 2020 Author Posted March 10, 2020 On 2/28/2020 at 2:48 PM, bfarber said: I've not gone in and played around with this, but something like this should probably work: {{if $results = explode( ',', $value )}} {{foreach $results as $item}} <li>{expression="trim($item)"}</li> {{endforeach}} {{endif}} Thanks a million @bfarber that did the trick. Just needed to add the <ul> tags
Recommended Posts
Archived
This topic is now archived and is closed to further replies.