Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#157 2012-03-30 18:32:26
Re: smd_xml : extract data from XML feeds
MattD wrote:
My guess is it’s the commas.
Yep, you need to override the delim
attribute.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#158 2012-04-03 05:20:31
Re: smd_xml : extract data from XML feeds
Ok, now I am using a feed where i need to get an attribute of an xml tag photo|taken
but I also need to format it like above format="created_at|date|%Y.%m.%d"
.
How do I replace created_at
with photo|taken
? It seems both format and the xml values use param_delim.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#159 2012-04-03 08:18:21
Re: smd_xml : extract data from XML feeds
MattD wrote:
It seems both format and the xml values use param_delim.
Yes they do. Well spotted. Try the latest beta which introduces tag_delim
(default = |
) for dealing specifically with the XML stream tags. param_delim retains its usage solely for plugin attributes.
Please let me know if it works; I haven’t actually tested it: I’d like to test it on the feed you’re working on since it saves me hunting around for a feed that matches the criteria. If you have any problems, please would you let me know the feed URL and I can take a look directly (PM me if necessary). Thanks.
Last edited by Bloke (2012-04-03 08:18:44)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#160 2012-04-03 15:48:54
Re: smd_xml : extract data from XML feeds
Bloke wrote:
MattD wrote:
Please let me know if it works; I haven’t actually tested it: I’d like to test it on the feed you’re working on since it saves me hunting around for a feed that matches the criteria.
Seems to work. I’m using the flickr.photos.search method of the Flickr API and I’m asking for the following extra fields of date_taken, title, url_l and tags.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#161 2012-05-22 10:48:15
Re: smd_xml : extract data from XML feeds
Is smd_xml working from an article body at all or do i need to invoke a separate form into it (textile turned off)?
<txp:smd_xml data=“http://www.kliklak.net/livedatesrss/&force_read=1” record=“item” fields=“title, guid, pubDate” target_enc=“UTF-8” />
<b>{pubDate}</b> – {title} – <a href=”{guid}” target=”_blank”>Details…</a>
</txp:smd_xml>
doesn’t work here, shows
{pubDate} – {title} – Details…
instead.
What am i doing wrong?
A hole turned upside down is a dome, when there’s also gravity.
Offline
#162 2012-05-22 10:53:09
Re: smd_xml : extract data from XML feeds
jayrope wrote:
What am i doing wrong?
Is the closing tag on the first line a forum typo or is it in your article like that? If so, that might explain things as the plugin won’t see the container.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#163 2012-05-22 10:58:38
Re: smd_xml : extract data from XML feeds
It was a typo. (THANX!)
Unfortunately now the code below doesn’t display anything.
<txp:smd_xml data=“http://www.kliklak.net/livedatesrss/&force_read=1” record=“item” fields=“title, guid, pubDate” target_enc=“UTF-8”>
<b>{pubDate}</b> – {title} – <a href=”{guid}” target=”_blank”>Details…</a>
</txp:smd_xml>
I hope it’s not another typo from me…
Could it be a cache issue?
Last edited by jayrope (2012-05-22 11:05:12)
A hole turned upside down is a dome, when there’s also gravity.
Offline
#164 2012-05-22 11:07:02
Re: smd_xml : extract data from XML feeds
jayrope
It works for me in an article with Textile disabled, and without the force_read=1 thing. What’s that for?
<txp:smd_xml data="http://www.kliklak.net/livedatesrss" record="item" fields="title, guid, pubDate" target_enc="UTF-8">
<b>{pubDate}</b> - {title} - <a href="{guid}" target="_blank">Details...</a>
</txp:smd_xml>
Last edited by Bloke (2012-05-22 11:07:26)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#165 2012-05-22 11:12:51
Re: smd_xml : extract data from XML feeds
Now i removed “/&force_read=1” from the feed URl, and it does work here as well. I just can’t explain to me, why. The source URL actually does contain a trailing slash, it is a section, not an article. –
Okay, but. VERY NICE.
I am glad you wrote this plug, Bloke, and will donate shortly.
P.S.: How can i display “currently no entries”, when the feed URL has no entries?
A hole turned upside down is a dome, when there’s also gravity.
Offline
#166 2012-05-22 11:18:18
Re: smd_xml : extract data from XML feeds
jayrope wrote:
The source URL actually does contain a trailing slash
The trailing slash doesn’t matter, it’s just the force_read thing that was throwing a wobbly for some reason.
I am glad you wrote this plug, Bloke, and will donate shortly.
Thank you.
How can i display “currently no entries”, when the feed URL has no entries?
Two options:
- Wait for me to add
<txp:else>
support (might not happen) - Cheat
Option 2:
<txp:variable name="has_xml"><txp:smd_xml data="http://www.kliklak.net/livedatesrss" record="item" fields="title, guid, pubDate" target_enc="UTF-8">
<b>{pubDate}</b> - {title} - <a href="{guid}" target="_blank">Details...</a>
</txp:smd_xml></txp:variable>
<txp:if_variable name="has_xml" value="">
Currently no entries
<txp:else />
<txp:variable name="has_xml" />
</txp:if_variable>
EDIT: Ummm, maybe. Not tested it. You may get data regardless because of the hard-coded infos in the container. In that case, I’m not sure off the top of my head. I might have to add else support sooner than I thought. There must have been a technical reason I haven’t added it already because it seems a no-brainer on the surface.
Last edited by Bloke (2012-05-22 11:22:43)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#167 2012-05-22 11:37:14
Re: smd_xml : extract data from XML feeds
Uhm, i am sort of hoping that this will work:
Upcoming concerts: <txp:smd_xml data=“http://www.kliklak.net/livedatesrss” record=“item” limit=“1”>{smd_xml_totalrecs}.</txp:smd_xml>
Can’t test right now though
Last edited by jayrope (2012-05-22 11:38:09)
A hole turned upside down is a dome, when there’s also gravity.
Offline
#168 2012-05-22 12:07:10
Re: smd_xml : extract data from XML feeds
jayrope wrote:
Uhm, i am sort of hoping that this will work:
You might need to add the set_empty="1"
attribute. So if nothing is found, the {replacement}
is cleared.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline