I’m trying to filter out anything that’s NOT rated PG or G. I tried this conditional:That type of conditional doesn’t seem to work. Is it possible to do more with this module than just check for the existence of an element? Thanks for the help and the great module!{if item_Rating == "PG"}{item_Title}{/if}
Yes, it only supports one conditional right now. I’ll try to add a few more useful conditionals in next version. Stay tune.
Okay, I just added standard EE operators on conditional variables. Actually it is pretty straight forward as EE built-in functions take care of everything.
As usual, version 1.2 can be downloaded in the Wiki area.
Example code:
{exp:ano_xml_parser:fetch source='http://www.w3schools.com/xml/simple.xml' refresh="0" parent_tag="breakfast_menu" child_tag="food"}
Food Name; {food_name} with only {food_calories} calories
Price: {food_price}
Description: {food_description}
{if food_name=="Belgian Waffles" OR food_calories<700}
I LOVE TO EAT {food_name} OR ANY FOOD WITH LESS THAN 700 calories.<br>
{/if}
{if food_dummy}
THIS LINE SHOULD NEVER BE SHOWN SINCE VARIABLE DOESN'T EXIST!<br>
{/if}
<hr>
{/exp:ano_xml_parser:fetch}
If we executed the xml parser twice in the same page, it only showed the rss data from the first one. So, the second one was totally gone and it became just a duplicated copy of the first one. Is that a bug or Did I make any mistake?
<h2>Technology</h2>
{exp:ano_xml_parser:fetch source='http://www.playpark.net/playpark/feed20/technology' refresh='0' parent_tag='channel' child_tag='item' limit='5'}
<a href="http://{item_link}" target='_blank' rel="noopener">{item_title}</a>
<small>Posted on {item_pubdate}</small>
<hr>
{/exp:ano_xml_parser:fetch}
<h2>Lifestyle</h2>
{exp:ano_xml_parser:fetch source='http://www.playpark.net/playpark/feed20/lifestyle' refresh='0' parent_tag='channel' child_tag='item' limit='5'}
<a href="http://{item_link}" target='_blank' rel="noopener">{item_title}</a>
<small>Posted on {item_pubdate}</small>
<hr>
{/exp:ano_xml_parser:fetch}
If we executed the xml parser twice in the same page, it only showed the rss data from the first one. So, the second one was totally gone and it became just a duplicated copy of the first one. Is that a bug or Did I make any mistake?
Yes, it is a bug and it is now fixed. You can try the latest version 1.2.1 in the wiki area. Thanks for reporting.
Okay, I just added standard EE operators on conditional variables. Actually it is pretty straight forward as EE built-in functions take care of everything. As usual, version 1.2 can be downloaded in the Wiki area.
Wow, that was fast. Thank You, Thank You, Thank You!
Yes, it is a bug and it is now fixed. You can try the latest version 1.2.1 in the wiki area. Thanks for reporting.
Wow… That was fast… I thought it might take days to get response from you. That’s why, I wrote another RSS reader module by myself yesterday. If I knew you were that fast, I would not have spent time on that.
Anyway, I do appreciate your efforts…
Cheers mate!
I am trying to pull last.fm API calls using this, for example, here, the top 10 tracks by an artist, on a page with that artist’s title.
{exp:ano_xml_parser:fetch source='http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist;={title}&api_key=7e2d7140fc13536f104d8fe05466f734' refresh='60' parent_tag='toptracks' child_tag='track' limit="10"}
This works perfectly fine when calling an artist’s name (the title tag) which is just one word, e.g. Radiohead. However, with artists with multiple words, it is calling a complete blank - the whole page’s template doesn’t show up, not just the information called here.
If, however, I use {title} in the last.fm artist page string, e.g. http://www.last.fm/music/{title} - it is fine, however many words there are in the {title} tag.
Any advice would be great, thanks! 😊
[edit: the semi-colon before the equals before the title tag isn’t there, it just keeps showing here for some reason!]
You have two ways to do it.
Escape space to (percentage sign + 20) before you pass on the URL value to the parser.
Or grab the latest version 1.2.2 in the Wiki area which does the same thing.
Sample code to your link:
Artist: cool man<br>
<br><br>
{exp:ano_xml_parser:fetch
source='http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=cool man&api_key=7e2d7140fc13536f104d8fe05466f734'
refresh='0'
parent_tag='toptracks'
child_tag='track'
limit="10"}
Track Name={track_name}<br>
Track Ranking={track_rank}<br>
Track URL={track_url}<br>
<hr>
{/exp:ano_xml_parser:fetch}
Sure, grab the latest 1.2.3 from the Wiki area as I have added the unique conditional {if no_results} tag.
Sample code to your link:
Looking for artist:arnoldc....<br>
===============================<br>
{exp:ano_xml_parser:fetch
source='http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=arnoldc&api_key=7e2d7140fc13536f104d8fe05466f734'
refresh='0'
parent_tag='toptracks'
child_tag='track'
limit="10"}
{if no_results}
No such artist is found in the system.<br>
{/if}
Track Name={track_name}<br>
Track Ranking={track_rank}<br>
Track URL={track_url}<br>
<hr>
{/exp:ano_xml_parser:fetch}
Sure, grab the latest 1.2.3 from the Wiki area as I have added the unique conditional {if no_results} tag. Sample code to your link:Looking for artist:arnoldc....<br> ===============================<br> {exp:ano_xml_parser:fetch source='http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=arnoldc&api_key=7e2d7140fc13536f104d8fe05466f734' refresh='0' parent_tag='toptracks' child_tag='track' limit="10"} {if no_results} No such artist is found in the system.<br> {/if} Track Name={track_name}<br> Track Ranking={track_rank}<br> Track URL={track_url}<br> <hr> {/exp:ano_xml_parser:fetch}
Excellent, but it’s not displaying the alternative where i’m using it - it’s with the following:
{exp:ano_xml_parser:fetch source='http://ws.audioscrobbler.com/2.0/?method=artist.getevents&artist;={title}&api_key=7e2d7140fc13536f104d8fe05466f734' refresh='60' parent_tag='events' child_tag='event'}
{if no_results}
This artist currently has no gigs listed on last.fm.
{/if}
<li><b><a href="http://www.seetickets.com/see/event.asp?artist={event_title}&filler3=id1thisisfakediy" target="_blank" rel="noopener">{event_startDate}</a></b><br>{event_venue_name}<br>{event_venue_location_city} / {event_venue_location_country}<br><a href="http://{event_url}" target="_blank" rel="noopener">last.fm</a> / <a href="http://www.seetickets.com/see/event.asp?artist={event_title}&filler3=id1thisisfakediy" target="_blank" rel="noopener">Buy tickets</a></li>
{/exp:ano_xml_parser:fetch}
I try your link and it works for me. Make sure you have 1.2.3 installed as shown in the control panel. Try to clear all cache data (within the parser’s control panel) or set refresh tag to zero to see what happens. I think it is using old cache data.
I put the code in a new template and embedded that - it also makes it easier to find where’s what! - and it works fine, thank you!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.