0

I am trying to out put the next 5 tour dates for a band. Unfortunately as rss feeds output the latest feed item first I need to find a way to reverse the order. My php skills are limited so I would appreciate any help.

{exp:rss_parser url="http://acousti.co/feeds/artist/artist_name" 
                    cache_refresh="10"
                    limit="5"
                    }

    {feed_items}  


                  <li>{item_date format="%F %d %Y"}&nbsp;&nbsp;<a href="{item_link}">{item_description}</a>
                  </li>

                 {/feed_items}
                {/exp:rss_parser}

1 Answer 1

1

You can do the inversion using stash lists.

This works in two stages. First load a stash list with the content of your feed call. Then recall the stash list with whatever ordering you care to specify.

Something like this:

{exp:stash:set_list name="tour_dates"}

    {exp:rss_parser url="http://acousti.co/feeds/artist/artist_name" 
        cache_refresh="10"
        limit="5"
        }

        {feed_items}  
            {stash:item_date}{item_date}{/stash:item_date}
            {stash:item_link}{item_link}{/stash:item_link}
            {stash:item_description}{item_description}{/stash:item_description}
        {/feed_items}

    {/exp:rss_parser}

{/exp:stash:set_list}

{exp:stash:get_list name="tour_dates" orderby="item_date" sort="desc"}

            <li>{item_date format="%F %d %Y"}&nbsp;&nbsp;<a href="{item_link}">{item_description}</a></li>

{/exp:stash:get_list}

Of course you'll need to set the orderby tag appropriate to your source data.

HTH

2
  • Thanks for your help - I installed Stash and tried your code but all that is being output is {item_date} {item_description}. Commented Sep 27, 2017 at 20:58
  • Presumably this is within the <li>...</li> tags, and you only get one line output? If so, that suggests in your code there is something wrong with the {exp:stash:get_list} call. If so, check the opening and closing tags are entered correctly ({ not ( etc.). If that is OK, can you post your actual code that is not working here so that others can have a look etc. Commented Sep 28, 2017 at 8:48

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.