1
我是新來的枝條。我以爲我已經掌握了基礎知識,但是完全停留在這個基礎上。枝條一對多關係
我有兩個數組:
books => [
[
'book_id' => ...,
'book_title' => ...,
],
],
和
tags => [
[
'tag_id' => ...,
'book_id' => ...,
'tag' => ...,
],
],
如何獲得枝條產生沿着這些線路
書名1個標籤1標籤2標籤3 tag5
東西書名2 tag1 tag3 tag4 tag2
等
到目前爲止,我有
{% for book in books %}
{{book.title}}
{% for tag in tags %}
what goes here to get a list of tags for this book
{%endfor%}
{% endfor %}
我知道這只是幾行代碼,但我不知道在哪裏可以在正確的方向開始 一個提示會非常感激。
非常感謝您的回覆迅速。你已經救了我幾個小時試圖解決它。 – JohnB