Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_xml : extract data from XML feeds
Any news on the super-duper version of this, which allow for attributes on fields?
What, did you think I would forget? Probably a good plan, given my advancing years…
Offline
#92 2011-03-26 19:37:42
- bojay
- Member

- Registered: 2010-04-13
- Posts: 11
Re: smd_xml : extract data from XML feeds
Hey Stef and everyone else!
This may be an easy one, but I have some difficulties with using a txp:custom_field inside the data string url.
What I need in a page template is a line like this:
<txp:smd_xml data=“http://www.boardgamegeek.com/xmlapi/boardgame/34?stats=1” record=“ratings” fields=“averageweight” >
And I have the dynamic id (number 34 in the above example) in the custom field called “bggid” for the article being served.
This doesn’t work for me:
<txp:smd_xml data=“http://www.boardgamegeek.com/xmlapi/boardgame/<txp:custom_field name=“bggid” />?stats=1” record=“ratings” fields=“averageweight” >
output: {averageweight}
</txp:smd_xml>
Everything is wrapped in a <txp:if_custom_field name=“bggid”> to make sure I don’t call the smd_xml unless I have content in the custom field.
The setup works if I hard-type the number into the data-sting.
Is there any rendering order that prevents me from this or any suggestions that will trap/generate my data url including my custom field number ?
Thanks
/Bo
Offline
Re: smd_xml : extract data from XML feeds
bojay Parsing nested tags needs single quote ' wrapping.
<txp:smd_xml data='http://.../<txp:custom_field name="bggid" />?stats=1' record="ratings" fields="averageweight">
Shorter: 'http://.../<txp:custom_field name="bggid" />?stats=1'
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
#94 2011-03-27 05:56:56
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: smd_xml : extract data from XML feeds
I’m finding the set_empty attribute isn’t working for me – anyone confirm it works/doesn’t work for them?
- in the data xml, there is
<other_points></other_points> other_pointsis specified in the attributefieldsof smd_xml- output is
{other_points}on-screen
Offline
#95 2011-03-27 09:10:06
- bojay
- Member

- Registered: 2010-04-13
- Posts: 11
Re: smd_xml : extract data from XML feeds
#93:
Thanks a lot Markus Merz – single quotes did the trick !
(now why didn’t I think of that myself .. sigh)
:)
Offline
Re: smd_xml : extract data from XML feeds
I know that this is not about this particular plugin, but I’m not really sure if any plugin does what I need…
I’ve started using smd_xml to pull in a Twitter feed from another organisation. The problem is that this organisation often puts URLs to their Facebook posts in their Tweets – and sometimes the Tweet is just one long URL (they haven’t figured out about URL shortening yet!).
Is there someway to convert the text returned from the Twitter feed to a link? For example, find anything starting with “http://” and convert that to a link.
Offline
Re: smd_xml : extract data from XML feeds
if you are open for javascript, then jquery could do it..
post your exact code (like surounding divs and stuff, so that it would be easier to select a certain item..) and maybe we are able to help..
Offline
Re: smd_xml : extract data from XML feeds
This is the sort of Tweets they send:
Parks Brigade are planning to undertake a hazard reduction burn on Sunday, weather permitting on Quartz Ridge near... http://fb.me/Y6Q0OYA8
In other words, they are posting full updates to the Facebook page and tweeting about the update. Sometimes, the tweet is just a URL to their photo gallery site.
As I say, I know that this is not an issue with the plugin, but I know from personal experience that the more we push Bloke’s plugins the more we find crazy things we want to do, and then he comes up with an even better plugin!
Offline
Re: smd_xml : extract data from XML feeds
well, dunno. i would do it via jquery, but maybe you are right, and bloke could provide some new build-in feature..
bloke?
Offline
#100 2011-03-31 12:19:30
Re: smd_xml : extract data from XML feeds
blokes plugins great great – but there area others which target twitter directly – I have used kml_twitter on an old site 4.08 – so not sure if it still works… but I had it working in 5 mins, links and all :)
Last edited by tye (2011-03-31 12:20:04)
Offline
#101 2011-04-13 13:12:40
Re: smd_xml : extract data from XML feeds
You were right – kml_twitter did the job very neatly for me.
But still waiting for the version that allows attributes on fields!
Offline
#102 2011-09-29 08:44:12
Re: smd_xml : extract data from XML feeds
Stef – going back to this feed
http://gdata.youtube.com/feeds/api/users/roundmountaingirls/uploads?v=2
I am trying to get a field called <media:description> which is enclosed within a <media:group> (along with other things)
<media:group><media:description type='plain'>Cabarita Sports Club had their biggest night ever, says club management, when the Round Mountain Girls did their home town show last Saturday night. This clip is a short shot of the audience and RMG with Banjovi introducing the band... 4 June 2011</media:description></media:group>
How do I do that?
I’ve tried {media:group}, {media:description}, {description}, {group}, {media|description} (as you can tell I have no idea)
Is there a way?
Offline
#103 2011-10-05 05:30:26
Re: smd_xml : extract data from XML feeds
Hey Stef – I was making that hard – media:description worked :)
In the same feed though under nested in <media:group> </media:group> I am trying to get media:content & media:thumbnail – If I include fields="media:category" then I have the placement tags {media:category}, {media:category|label}, {media:category|scheme}, but if I include fields="media:thumbnail, media:content" – I get nothing :(
When using debug=“3” – are the fields listed under “++ PAGING INFO ++” the ones you can extract and are these the replacement tags to use – or does this depend on what values you have used in the tag?
Would it be possible to include a return all fields (without specifying) – so you know which replacement tags to use?
Just trying to understand how smd_xml working :)
Also – I’m using v.30 – is there a dev version I have heard mentioned :) Care to share?
Cheers
Offline
#104 2011-10-06 01:33:26
Re: smd_xml : extract data from XML feeds
Pssssst, Tye or anyone else who wants to try the next beta
Loads of goodies packed into this release that should solve all the issues people have raised over the last few months. For example, you can now specify field hierarchies, which is damn handy if the XML feed reuses the same node name in many places: you can just target the specific->node->tree->name you want (if you need just the root one, prefix it with the record name).
If that’s not enough granularity you can also match nodes based on their content (using a regex). And if you want to get really funky you can ‘watch’ for tags in real time and trigger a Txp form whenever that tag starts or ends (see ontagstart / ontagend). One thing I wanted to add but haven’t yet managed (because of the ugly code requirements) is the ability to specify wildcards for extracting tags. That’d be frickin’ cool, but remains a pipe dream at the moment and I’ve wasted enough time trying to get it to work already.
What else is in this version. Erm, tentative support for XSLT to be applied to your XML document (willing testers required: I know jack-all about XSL) or you can apply custom regex replacements to clean up the feed or trim it to your liking. Plus a slew of bug fixes, FTP and SOAP support, datawrap for awkward / malformed feeds, var_prefix so you can embed smd_xml tags inside smd_xml tags(!) yahde yahde…
Please let me know how you get on with this beta and if there’s anything squiffy about it I’ll fix it before it’s final. All things being well I can release it like this, but it could do with some more examples in the help so if anyone comes across some really cool uses of the new attributes, please let me know and I’ll put them in.
Share and Enjoy™
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#105 2011-10-06 03:01:35
Re: smd_xml : extract data from XML feeds
way cool – thanks stef :)
initial testing looks great – I’ll be working on this full time tomorrow
Thanks mate :)
Offline