• Resolved morphmeta

    (@morphmeta)


    Hi there,

    I’m consuming a json feed from the nhl and want to display the upcoming games. The feed url is:

    https://statsapi.web.nhl.com/api/v1/schedule

    My attempt just for testing was like this one:

    [jsoncontentimporter url=https://statsapi.web.nhl.com/api/v1/schedule]
    {subloop-array:dates:-1}
    {date}
    {subloop-array:dates.games:-1}
    {gameType} ({season})
    {/subloop-array:dates.games}
    {/subloop-array:dates}
    [/jsoncontentimporter]

    This worked so far. Now I wanted to display the names of the teams:

    [jsoncontentimporter url=https://statsapi.web.nhl.com/api/v1/schedule]
    {subloop-array:dates:-1}
    {date}
    {subloop-array:dates.games:-1}
    {teams.away.team.name}
    {teams.home.team.name}
    {/subloop-array:dates.games}
    {/subloop-array:dates}
    [/jsoncontentimporter]

    I tried different subloops around dates.games.teams but was not able to get a result. Can You please guide me in the right direction here?

    Many thanx ahead!

    Cheers

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

    (@berkux)

    Hi,

    try this:

    [jsoncontentimporter url=https://statsapi.web.nhl.com/api/v1/schedule numberofdisplayeditems=-1 urlgettimeout=5 debugmode=10 ]{subloop-array:dates:-1}
    {dates.date}<br>
    {subloop-array:dates.games:-1}
    {dates.games.gameType} ({dates.games.season})<br>
    {subloop:dates.games.teams:-1}
    {subloop:dates.games.teams.away:-1}
    {subloop:dates.games.teams.away.team:-1}away: {dates.games.teams.away.team.name}
    {/subloop:dates.games.teams.away.team}
    {/subloop:dates.games.teams.away}
    {/subloop:dates.games.teams}
    {/subloop-array:dates.games}
    {/subloop-array:dates}
    [/jsoncontentimporter]

    With the free plugin you have to have several subloops to get in the depth of the json. The pro plugin can access thi directly with one line.

    Bernhard

    Thread Starter morphmeta

    (@morphmeta)

    Hi Bernhard,

    thank You very much for looking into this. The way You pointed it out works great.

    My conclusion here is that Your free plugin is a great way to go for everyone without knowledge of PHP and creating custom shortcodes/plugins in WP. Additionally I didn’t find any comparable plugin to Yours.

    Keep it up – You’ve done some great stuff here.

    Cheers
    Dirk

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Got stucked’ is closed to new replies.