Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#241 2018-09-09 19:13:22
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: smd_xml : extract data from XML feeds
Thanks jakob.
Offline
#242 2019-10-08 13:58:07
Re: smd_xml : extract data from XML feeds
Is there a version of smd_xml that works with 4.73 & PHP 7.3 that is available for download?
Offline
#243 2019-10-08 14:53:07
Re: smd_xml : extract data from XML feeds
towndock wrote #319594:
Is there a version of smd_xml that works with 4.73 & PHP 7.3 that is available for download?
Try v0.4.2 which should work a heap better on more recent Textpattern/PHP versions. Please let me know if anything is amiss.
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
#244 2019-10-08 15:00:59
Re: smd_xml : extract data from XML feeds
Bloke, that’s beautiful. A wall of errors just disappeared (this plugin gets used a bunch on one of my fave sites.)
Thank you.
Offline
#245 2019-10-08 15:02:07
Re: smd_xml : extract data from XML feeds
No problems. I just spotted that I missed a couple of tag registrations for the conditional tags. I’ll add those and get a new version bundled up in a few minutes, sorry.
EDIT: Done. v0.4.3 is up
Last edited by Bloke (2019-10-08 15:08:48)
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
#246 2020-07-14 14:18:59
Re: smd_xml : extract data from XML feeds
Now that I finished with my deadlines/submissions, I am back trying to enhance the media shortcode and I am examining the vimeo API in order to parse some info in the pages. Vimeo has an xml file for each video, the ID of which is the same as the one in the page url. Sample from: http://vimeo.com/api/v2/video/336049258.xml
<?xml version="1.0" encoding="UTF-8"?>
<videos>
<video>
<id>336049258</id>
<title>Self as Actor: Colonising identity</title>
<description>Footage from the exhibition 'Self as Actor: Colonising identity,' exhibition, (part of the State Machines project) at the NeMe Arts Centre. <br /> <br /> Further information can be found on http://www.neme.org/projects/state-machines/self-as-actor</description>
<url>https://vimeo.com/336049258</url>
<upload_date>2019-05-14 04:22:20</upload_date>
<thumbnail_small>https://i.vimeocdn.com/video/782791131_100x75.jpg</thumbnail_small>
<thumbnail_medium>https://i.vimeocdn.com/video/782791131_200x150.jpg</thumbnail_medium>
<thumbnail_large>https://i.vimeocdn.com/video/782791131_640.jpg</thumbnail_large>
<user_id>321806</user_id>
<user_name>NeMe</user_name>
<user_url>https://vimeo.com/nemeorg</user_url>
<user_portrait_small>https://i.vimeocdn.com/portrait/885175_30x30</user_portrait_small>
<user_portrait_medium>https://i.vimeocdn.com/portrait/885175_75x75</user_portrait_medium>
<user_portrait_large>https://i.vimeocdn.com/portrait/885175_100x100</user_portrait_large>
<user_portrait_huge>https://i.vimeocdn.com/portrait/885175_300x300</user_portrait_huge>
<duration>384</duration>
<width>426</width>
<height>240</height>
<tags>statemachines, neme, exhibitions, social media</tags>
<embed_privacy>anywhere</embed_privacy>
</video>
</videos>
I have installed the plugin and I am testing this code in a textile disabled article
<txp:smd_xml data="http://vimeo.com/api/v2/video/336049258.xml" record="item" fields="title,description,url,thumbnail_large,thumbnail_medium" wraptag="" limit="1" cache_time="86400">
<p><a rel="external" href="{url}">{title}</a>
<br />{description}</p>
<picture>
<source media="(min-width:650px)" srcset="{thumbnail_large}" />
<source media="(min-width:465px)" srcset="{thumbnail_medium}" />
<img src="{thumbnail_medium}" alt="{title}" style="width:auto;" />
</picture>
</txp:smd_xml>
but it returns no results. It is the first time I am using this plugin (or the vimeo api), and I hope that I am using both correctly.
On a similar vein, I seem to remember that some xml parsing functions are now available in the core and I was wondering if something similar to the above could be achieved without a plugin.
> edit: typo in the code
Last edited by colak (2020-07-14 14:20:47)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#247 2020-07-14 14:25:48
Re: smd_xml : extract data from XML feeds
Try with record="video"
since that’s what each record is wrapped with.
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
#248 2020-07-14 16:14:26
Re: smd_xml : extract data from XML feeds
Bloke wrote #324509:
Try with
record="video"
since that’s what each record is wrapped with.
We have made a step
this is my parsed outcome…
<p><a rel="external" href="{url}">{title}</a>
<br />{description}</p>
<picture>
<source media="(min-width:650px)" srcset="{thumbnail_large}" />
<source media="(min-width:465px)" srcset="{thumbnail_medium}" />
<img src="{thumbnail_medium}" alt="{title}" style="width:100%;height:auto;" />
</picture>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#249 2020-07-14 16:21:16
Re: smd_xml : extract data from XML feeds
colak wrote #324514:
We have made a step
The XML endpoint URL doesn’t return any data for me when I download it. Just a blank structure with no data in any of the nodes. Hence there’s nothing to replace. Are you sure the URL is correct?
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
#250 2020-07-14 16:48:18
Re: smd_xml : extract data from XML feeds
You are absolutely right. When I am logged out of vimeo the xml returns an empty structure.
I discovered that json returns the expected results using https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/336049258
. I am now examining how to edit them in order to only show what is needed.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#251 2021-03-03 01:41:04
- saccade
- Plugin Author
- From: Neubeuern, Germany
- Registered: 2004-11-05
- Posts: 521
Re: smd_xml : extract data from XML feeds
Hi,
I can’t figure out how to use “match” correctly:
<txp:smd_xml data="https://evebc.de/files/LosungenFree2021.xml"
record="Losungen" fields="Datum,Losungstext,Losungsvers,Lehrtext,Lehrtextvers"
match="{Datum}|2021-03-03T00:00:00" wraptag="ul">
<li>{Datum} <strong>{Losungstext} ({Losungsvers})</strong></li>
<li>{Lehrtext} ({Lehrtextvers})</li>
</txp:smd_xml>
or should it be match="Datum|2021-03-03T00:00:00"
Nothing did work yet, even tried other delimiters,
what I need to do is filter the record with the node of today. So the above is only the testing code, the date will be dynamically change every day.
Offline
#252 2021-03-03 15:23:53
Re: smd_xml : extract data from XML feeds
colak wrote #324516:
I discovered that json returns the expected results using
https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/336049258
. I am now examining how to edit them in order to only show what is needed.
Certainly too late, but for the record:
<txp:etc_query url="https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/336049258" query="." markup="json">
{html?}
{description?}
</txp:etc_query>
Offline