• Resolved Aureline

    (@aureline)


    Hi,
    I’m trying to retrieve and display the data from the “training_category”, “training_cycle” and “training_type” elements of this json file, but I’m not able to do so.

    Here my current code :

    [jsoncontentimporter url="https://brewingtheory.hop3team.com/formations.json" basenode=trainings]
    <article>
    <h2>{name}</h2><br/>
    {subloop-array:training_category}
    {training_category.name}
    {/subloop-array:training_category}
    <a >Je suis intéressé·e</a>
    </article>
    [/jsoncontentimporter]

    And the items I want to recover :

    {
      "trainings": [
        {
          "slug": "immersion-la-brasserie-artisanale-non-eligible-cpf",
          "id": "f720bf2a-8565-4e6c-b5e4-c93afb2ecbbd",
          "name": "IMMERSION - La Brasserie Artisanale // non éligible CPF",
          "reference": "BREWBATH",
          "training_category": {
            "id": 6,
      ->>   "name": "Formation sur mesure",
            "discarded_at": null
          },
          "training_cycle": {
            "id": 1,
      ->>   "name": "Production",
            "discarded_at": null
          },
          "training_type": {
            "id": 1,
      ->>   "name": "Présentiel",
            "discarded_at": null,
            "on_site": true
          },
    ...

    How can I get the training category name, trainig cycle name and training type name ?

    Thanks for your help

    • This topic was modified 1 year, 5 months ago by Aureline.
    • This topic was modified 1 year, 5 months ago by Aureline.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author berkux

    (@berkux)

    Hi,

    You can do this, according to https://www.youtube.com/watch?v=RBlrAUVywAk

    Use the URL and the basenode and create a JCI-Template with the JCI-free-Block. This gives you this:

    [jsoncontentimporter url="https://brewingtheory.hop3team.com/formations.json" basenode="trainings" debugmode="10"]{subloop-array:1:-1}<br>
            slug = {slug}<br>
            id = {id}<br>
            name = {name}<br>
            reference = {reference}<br>
          {subloop:training_category:-1}
                id = {training_category.id}<br>
                name = {training_category.name}<br>
                discarded_at = {training_category.discarded_at}<br>
        {/subloop:training_category}
          {subloop:training_cycle:-1}
                id = {training_cycle.id}<br>
                name = {training_cycle.name}<br>
                discarded_at = {training_cycle.discarded_at}<br>
        {/subloop:training_cycle}
            certified = {certified}<br>
          {subloop:training_rhythm:-1}
                id = {training_rhythm.id}<br>
                name = {training_rhythm.name}<br>
                discarded_at = {training_rhythm.discarded_at}<br>
        {/subloop:training_rhythm}
            training_recurrence = {training_recurrence}<br>
          {subloop:training_type:-1}
                id = {training_type.id}<br>
                name = {training_type.name}<br>
                discarded_at = {training_type.discarded_at}<br>
                on_site = {training_type.on_site}<br>
        {/subloop:training_type}
            type = {type}<br>
            duration = {duration}<br>
            goals = {goals:html}<br>
            targeted_jobs = {targeted_jobs}<br>
          {subloop:training_speciality:-1}
                code = {training_speciality.code}<br>
                title = {training_speciality.title}<br>
                created_at = {training_speciality.created_at}<br>
                updated_at = {training_speciality.updated_at}<br>
        {/subloop:training_speciality}
            public_display = {public_display}<br>
            description = {description}<br>
            compliance = {compliance}<br>
            compliance_max = {compliance_max}<br>
          compliance_missing:<br>
            {subloop-array:compliance_missing:-1}<br>
              {compliance_missing.}
            {/subloop-array:compliance_missing}<br>
            compliance_missing_indicators = {compliance_missing_indicators}<br>
            archived = {archived}<br>
            has_program = {has_program}<br>
            contact_email = {contact_email}<br>
            contact_phone = {contact_phone}<br>
            duration_day = {duration_day}<br>
            training_price = {training_price}<br>
            training_price_vat_excl = {training_price_vat_excl}<br>
            training_price_vat_incl = {training_price_vat_incl}<br>
            price_text = {price_text}<br>
            training_vat = {training_vat}<br>
            location = {location}<br>
            accessibility = {accessibility}<br>
            statistic = {statistic}<br>
            statistic_success = {statistic_success}<br>
            other_indicator = {other_indicator}<br>
            other_indicator_doughnut_display = {other_indicator_doughnut_display}<br>
            formation_level = {formation_level}<br>
      {/subloop-array:1}<br> [/jsoncontentimporter]
    Thread Starter Aureline

    (@aureline)

    Hi,

    Thanks for your help, that exactly what I’m looking for and that work perfectly !

    Have a nice day,
    Regards,
    Auréline

    Plugin Author berkux

    (@berkux)

    Hi Auréline,
    perfect!
    You might write a review here for the Plugin. This would be very nice.

    Thank you,
    Bernhard

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get a subloop’ is closed to new replies.