what i Need:
string as follows:
["Product_Name"]=> string(362) "Top End Transport System,Band Combiner Devices,Our Mid Level Transport System,The Introductory Transport System,In-Line Amplification Systems,Intelligent Ethernet Access System,Ethernet Access System,Intelligent Ethernet Access System (Ieas 05),Intelligent Ethernet Access System (Ieas 06),Intelligent Ethernet Access System (Ieas 03),Ethernet Aggregation Device" }
here is twig code:
{% set foo = item.Product_Name|split(',') %}
{{ dump (foo) }}
{% for i in item.Product_Name|slice(0, 5) %}
{{ dump(i) }}
{% endfor %}
You have to loop over your foo
variable in order to print your products slice foo
in order to get first five names foo|slice(0, 5)
{% set foo = item.Product_Name|split(',') %}
{% for i in foo|slice(0, 5) %}
{{ dump(i) }}
{% endfor %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With