Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#97 2012-09-21 14:05:07

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,302

Re: etc_query: all things Textpattern

Zanza wrote:

</li>{title?}</li>

Hi Zanza,
simply proofreading your code: Might it be the closing </li> at the beginning?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#98 2012-09-21 14:10:04

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

Ops! Thank you, Uli, well spot! But no, it doesn’t change. Not even the h4 tag is displayed… :(

Offline

#99 2012-09-21 15:12:58

etc
Developer
Registered: 2010-11-11
Posts: 5,013
Website GitHub

Re: etc_query: all things Textpattern

That’s weird. If you replace markup="xml" by markup="html", it works, but that’s weird:

<txp:etc_query url="http://gdata.youtube.com/feeds/api/users/boscartoon/playlists?v=2"
  query="feed/title"
  markup="html"
  wraptag="ul" break="li"
  label="News from Youtube" labeltag="h4">
    {?}
</txp:etc_query>

There must be a namespacing issue I don’t understand, or I have introduced some bug in the latest version. Will check it, sorry.

Offline

#100 2012-09-21 15:42:00

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

Thank you, it actually works: I can extract any node, as long as it isn’t “namespace-d”.

That is: I can’t extract media:group tag, or yt:countId, etc. Maybe there is a specific syntax for those?

Offline

#101 2012-09-21 15:51:01

etc
Developer
Registered: 2010-11-11
Posts: 5,013
Website GitHub

Re: etc_query: all things Textpattern

That’s the drawback of importing them as html: they become group and countId (can you try?). Importing as xml works too if I put

<txp:etc_query url="http://gdata.youtube.com/feeds/api/users/boscartoon/playlists?v=2"
  query="*[name()='feed']/*[name()='title']"
  markup="xml"
  wraptag="ul" break="li"
  label="News from Youtube" labeltag="h4">
    {?}
</txp:etc_query_test>

Help’s example feed works fine, so there must be no bug, I just have to learn xml.

Offline

#102 2012-09-21 16:14:21

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

group and userId doesn’t work. I’ll try the new syntax with markup xml and report back, thanks.

Offline

#103 2012-09-21 16:21:59

etc
Developer
Registered: 2010-11-11
Posts: 5,013
Website GitHub

Re: etc_query: all things Textpattern

They go lowercase, sorry. This works for me:

<txp:etc_query url="http://gdata.youtube.com/feeds/api/users/boscartoon/playlists?v=2"
  query="//userid"
  markup="html"
  wraptag="ul" break="li"
  label="News from Youtube" labeltag="h4">
    {?}
</txp:etc_query>

Two rows are retrieved, you’ll have to target with more precision.

Offline

#104 2012-09-21 16:33:03

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

Genious! Thank you, you’ve been incredibly helpful!

Offline

#105 2012-09-21 16:49:48

etc
Developer
Registered: 2010-11-11
Posts: 5,013
Website GitHub

Re: etc_query: all things Textpattern

Fine! Thanks for testing and stay tuned: I am already patching etc_query with namespaces.

Edit: could you keep the feed online for some hours, for testing? Many thanks.

Last edited by etc (2012-09-21 16:52:15)

Offline

#106 2012-09-21 16:51:38

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

Ok, one more thing: I’m trying to extract more than one fields or attributes from a node. Let’s sat I want to display both entry’s title and its links href attributes.

This is a syntax problem inside the curly brackets: I haven’t figured out how to, yet… :)

Offline

#107 2012-09-21 16:56:16

etc
Developer
Registered: 2010-11-11
Posts: 5,013
Website GitHub

Re: etc_query: all things Textpattern

For link href, for example, it will be

{.//link/@href?}

Attributes are preceded by (at) (I have no luck with textile), and ? is etc_query syntax for value, without it you get href=”…”.

Last edited by etc (2012-09-21 16:59:03)

Offline

#108 2012-09-21 17:02:51

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: etc_query: all things Textpattern

Yess! Got it! It works perfectly, thanks!

Offline

Board footer

Powered by FluxBB