CMS Development

Farid
参加者 | Platinum Partner
参加者 | Platinum Partner

Loop a group inside another loop group

解決

Hi,

I am wondering if it's possible to loop a group inside the looped parent group.

I get this error

Farid_0-1611855120548.png

Please help me how can I do it

 

Thanks in forward

Kind regards

Farid

0 いいね!
1件の承認済みベストアンサー
piersg
解決策
キーアドバイザー

Loop a group inside another loop group

解決

Hi @Farid you just need to use a nested for loop:

 

{% set fils = module.fil %}
{% for fil in fils %}
  {{ fil.filter_title }}
  {% for accordion in fil.accordion %}
  ..
    {# accordion code here #}
  ..
  {% endfor %}
{% endfor %}

 

元の投稿で解決策を見る

4件の返信
piersg
解決策
キーアドバイザー

Loop a group inside another loop group

解決

Hi @Farid you just need to use a nested for loop:

 

{% set fils = module.fil %}
{% for fil in fils %}
  {{ fil.filter_title }}
  {% for accordion in fil.accordion %}
  ..
    {# accordion code here #}
  ..
  {% endfor %}
{% endfor %}

 

Farid
参加者 | Platinum Partner
参加者 | Platinum Partner

Loop a group inside another loop group

解決

Hi @piersg 
Thank you so much. Your codes work well (y)

Best regards

Farid

dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

Loop a group inside another loop group

解決

Hey @Farid 

Could you post more of your code?  The yellow indicates a warning, not an error

@Bryantworks@Anton can you all lend a hand 🤙

 

0 いいね!
Farid
参加者 | Platinum Partner
参加者 | Platinum Partner

Loop a group inside another loop group

解決

Hi @dennisedson 

 

Yes, sure! Here are other screens from my job.

Farid_3-1611910991863.png

Farid_4-1611911020880.png

 

Actually, my goal is to have a group of filters, which each filter has a group of accordions inside. In this case, Filter Group has a loop that works fine and an accordion group inside the filter group has also loop and shows nothing in output.

Farid_1-1611910789741.png

Farid_7-1611911305231.png

 

Farid_5-1611911106175.pngFarid_6-1611911146020.png

Please tell me if it's possible at all to have a repeat group inside another repeated group.

Thanks in forward

My best regards

Farid

 

0 いいね!