Hi,
I have a output (from a TV) like this:
test1;test2;test3;
How can I output it like:
<span class="tag">test1</span><span class="tag">test2</span><span class="tag">test3</span>
Hi,
I have a output (from a TV) like this:
test1;test2;test3;
How can I output it like:
<span class="tag">test1</span><span class="tag">test2</span><span class="tag">test3</span>
For example with a custom snippet:
[[formatTv? &tvValue=`[[*myTv]]`]]
Snippet formatTv:
<?php
$values = explode(';', $tvValue);
$output = '';
foreach($values as $value){
$output .= '<span class="tag">' . $value . '</span>';
}
return $output;
Thank you very much. That worked.
I changed the code a bit to make a custom output filter:
$values = explode(';', $input);
$output = '';
foreach($values as $value){
$output .= '<span class="tag">' . $value . '</span> ';
}
return $output;
and then call it like so:
[[+tv.myTV:explodeBySemi]]
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.