1

I'm working with EE v2.9.3 and Structure v3.3.14.5 I have simple structure hierarchy

MAIN PARENT
- parent 1
---child 1a
---child 1b
- parent 2
---child 2a

and so on. I want to create json for my javascript file. So, I started with creating snippet with that structure:

<script type="text/javascript">
var d = [
      {exp:structure:entries channel="first-channel" disable="categories|category_fields|member_data|pagination" dynamic="no" status="open"}
    {          
        "name": "{title}",
        "locations": [
         {
            "name": "{title}",
            "phone": "xxx",
            "email": "xxx",                
          }
        ],  
    },            
      {/exp:structure:entries}

];
console.log(d);
</script>

And it's working. I can see my objects created with names parent 1, parent 2 etc. Now I want to create "locations" key (whatever there's 1 or more entries) which will be contains my child entries like child 1a, 1b etc. I tried with nested {exp:structure:entires} but it doesn't work. So my question is - how can I create locations key based on nested exp loop?

0

How did you nest the second entries tag? If you just added it within it might not work, might need to use an embed. But someone else might know if a better way.

3
  • I just drag&drop positions in structure tree but entries have proper parent_id values.
    – MMPL1
    Sep 16 at 7:58
  • No i mean how did you nest in the template? Sep 16 at 14:53
  • Nevermind, I manage to do it with embed. Thanks for the tip :)
    – MMPL1
    Sep 17 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.