我想總計數resuslt。我已經做到了像總組結果,並在總成績中的一個產品....計數在沒有圈的樹枝上
,如: -
總產品的組= 15
在一組展示36產品。
第二組顯示56個產品。
我要顯示總組積結果= 36 + 56 => 92 而不for循環。
樹枝文件:
<table>
<h2> Showing {{ templates | length }} Products</h2>
{% for groupResults in templates %}
{% if groupResults.doclist.docs[0].first_product_name is defined %}
Show all {{ groupResults | length }} results
<tr>
<td>
{{ groupResults.doclist.docs[0].first_product_name }}
{% if groupResults.doclist.numFound > 4 %}
<a href="{{ path("design_picker_catalog", { "productSlug": groupResults.doclist.docs[0].first_product_slug, "search": searchTerm }) }}" style="float:right">Show all {{ groupResults.doclist.numFound }} results</a>
{% endif %}
</td>
</tr>
<tr>
{% set count = 0 %}
{% for template in groupResults.doclist.docs %}
<td>
<a href="{{ path("customer_design_editor", { "templateSlug": template.slug, "productSlug": template.product_slug[0] }) }}">
<img src="{{ path("design_template_thumbnail_by_slug", { "slug": template.slug}) }}" alt="" />
</a>
</td>
{% set count = count + 1 %}
{% endfor %}
{% if count < 4 %}
{% for i in count..3 %}
<td> </td>
{% endfor %}
{% endif %}
{% else %}
{% endif %}
{% endfor %}
您可以編輯您的文章,以使其更容易被理解?我真的不明白你想做什麼。 – cheesemacfly
確保............ – Sid