In phalcon templating engine volt (which looks like a twig) you can get all the entries:
{% for product in products %}
Name: {{ product.name }}
Description: {{ product.description }}
price: {{ product.price}}
{% endfor %}
So, in my scenario, I am creating a crud template that will be used for different models. What I wanted to achieve in this template is that all the columns in this view are not hardcoded. Therefore, I store the columns that I wanted to show in an array (defined in the controller, passed to the view):
$cols = ['name','description','price']
In a view to display all columns:
{% for product in products %}
{% for col in cols %}
{{ col }}: {{ product.col }}
{% endfor %}
{% endfor %}
Obviously, this will result in an error because the product does not have a col.
Is there any solution or alternative for this?
source
share