0
Welcome Guest! Login
0 items Join Now

You are not authorized to access that page, please login...

SOLVED Particles: foreach with foreach

    • V-Web's Avatar
    • V-Web
    • Rocketeer
    • Posts: 91
    • Thanks: 0

    SOLVED Particles: foreach with foreach

    Posted 8 years 2 months ago
    • I'm creating a particle that requires a foreach within a foreach. I need to make a list of countries and assign the available languages to them. What I've done so far:

      YAML file:

      listgriditems:
            type: collection.list
            array: true
            label: Country Lists
            description: Create each item to appear in the content row.
            value: title
            ajax: true
      
            fields:
              .country:
                type: input.text
                label: Country
                Description: Country label
              .image:
                type: input.imagepicker
                label: Image
                description: Select desired country image.
              .languages:
                type: collection.list
                array: true
                label: Language Lists
                description: Create each item to appear in the content row.
                value: language
                ajax: true
      
                fields:
                  .countrylan:
                    type: input.text
                    label: Language
                  .link:
                    type: input.text
                    label: Link

      In the backend this works perfectly. But how to I retrieve the data from the second foreach in my TWIG file?

      I also have problems when I rename the first array from "listgriditems" to "languageitems". When I make the appropriate changes to the TWIG file this does not render. Changing it back to "listgriditems" makes it working again. What am I overlooking here?
    • Last Edit: 8 years 2 months ago by V-Web. Reason: Forgot some info
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13481
    • Web Designer/Developer

    Re: SOLVED Particles: foreach with foreach

    Posted 8 years 2 months ago
    • Please post your FTP logon, password and FTP URL in the secure area of your post.

      I need to see the twig file as well as yaml.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • V-Web's Avatar
    • V-Web
    • Rocketeer
    • Posts: 91
    • Thanks: 0

    Re: SOLVED Particles: foreach with foreach

    Posted 8 years 2 months ago
    • Ah, guess I've solved the issue myself already

      YAML file was correct. In order to display this on the frontend you simply have to follow the method for the first foreach.

      How hard can it be :)
    • Last Edit: 8 years 2 months ago by V-Web.

Time to create page: 0.043 seconds