Is this the most efficient way to use matrix in a template where different block types need outputting in various area of the HTML markup? I have 9 block types that need to be placed in various areas of the HTML markup.
{# Create a variable with the matrix fields in #}
{% set var = entry.sofa %}
{# Is the block in the variable #}
{% if var.block.type('twoSeaterSofa') %}
{# block is in variable #}
{% for block in var.block.type('twoSeaterSofa') %}
{# output block #}
{{ block.price }}
{% endfor %}
{% endif %}
Grateful for any advice or code.