Hi, Thanks for posting this module, it does exactly what I need. The only small issue I have is that if the XML file is not found or the XML is invalid PHP error messages are echo’d to the page, breaking the layout. Is there an easy way to alter the module to have it fail silently? Sorry I’m not very familiar with PHP. It would be perfect if it would fail silently or just output a simple error to the page. Thanks again.
Hi bg2K, Don’t you want to see errors if something goes wrong with the templates and address the template codes instead?
In any case, if you need this approach, you may add this line to the first line of mod.ano_xml_parser.php to suppress all PHP errors on this page:
error_reporting(0);
Cheers.
hi arnold, thanks for this module, it’s exactly what I was looking for to grab my Last.fm xml feeds. I have a question if you don’t mind:
How do I check if a tag has content? I’m pulling an artist thumbnail and only want to display it if it exists. A standard {if image !=""} doesn’t work because an ‘empty’ tag
<image size="small">
takes on the variable of the previous non-empty tag. Have a look at this page for a live example.
Hi Bob, Yes, this module is very basic and doesn’t implement some of the EE tags that you would usually see in first-party modules. Conditional case is not implemented.
Hi Bob,
I have just updated the parser to v1.1 with three new changes:
Sample template codes to your xml feed:
{exp:ano_xml_parser:fetch
source='http://ws.audioscrobbler.com/2.0/user/Taggetig/topartists.xml'
refresh='0' parent_tag='topartists' child_tag='artist' limit="10"}
Name: {artist_name}, Ranking: {artist_rank}
URL:: <a href="http://{artist_url}">{artist_url}</a><br>
{if artist_image} image size={artist_image_size}: {artist_image}<br>{/if}
{if artist_image_2} image size={artist_image_size_2}:{artist_image_2}<br>{/if}
{if artist_image_3} image_size={artist_image_size_3}:{artist_image_3}<br>{/if}
<hr>
{/exp:ano_xml_parser:fetch}
Please download v1.1 in the Wiki area.
arnold, thanks so much, it does everything I wanted it to do now. much appreciated 😊
Great! I have just moved to the version to the Wiki area.
Thanks for the reply at Solspace Arnold. Before I get it installed, is this XML too deeply nested to use the module, or do you think it would work? http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago&category=vehicle/car
Just tested it and seem to work fine with the link.
Sample Code
{exp:ano_xml_parser:fetch
source='http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago&category=vehicle/car'
refresh='0' parent_tag='listings' child_tag='element' limit="10"}
ID:{element_id}
body:{element_body}
location name: {element_location_name}
image element 1 source:{element_images_element_src}<br>
image element 2 source:{element_images_element_src_2}<br>
price:{element_attributes_price}<br>
<hr>
{/exp:ano_xml_parser:fetch}
I uploaded the module, but get the following error when I click on the modules tab:
Unable to load the following language file:
lang.ano_xml_parser_1_1.php
The language file that was with the ZIP was lang.ano_xml_parser.php, so is this an error with the naming of the language file or in the code of the module?
Sorry for the questions but still a bit of an EE newb.
Finally solved it:
You need to put the language file in the right directory, ie /system/languages/english.
Moved the language file, but still getting the same error:
Unable to load the following language file:
/lang.ano_xml_parser_1_1.php
The ZIP file had the ‘_1_1’ appended on the end for the version info, but that needed to be removed to have the file names process correctly. Just a heads up for anyone else that is installing this module. Now to see if we can get it to work…
I discovered your module and it’s JUST what I need. I have one problem, and I’m not sure if this is something I’m overlooking or if it’s something the module doesn’t support.
Here’s an example of the xml data I’m trying to parse:
<item>
<Description>COSBY SHOW: SEASON 4, THE Video</Description>
<Title>COSBY SHOW: SEASON 4, THE</Title>
<Rating>Not Rated</Rating>
<Genre>Comedy</Genre>
</item>
I’m trying to filter out anything that’s NOT rated PG or G. I tried this conditional:
{if item_Rating == "PG"}{item_Title}{/if}
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!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.