Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#361 2021-01-30 12:42:08

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

Re: etc_query: all things Textpattern

A small PHP 8 compatible update.

Offline

#362 2021-01-30 17:07:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,081
Website GitHub Mastodon Twitter

Re: etc_query: all things Textpattern

etc wrote #328420:

A small PHP 8 compatible update.

Does it also work on php 7.x?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#363 2021-01-30 17:13:20

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

Re: etc_query: all things Textpattern

colak wrote #328425:

Does it also work on php 7.x?

It should work on any php 5.3.10+. Its own home is on php 5.4.8.

Offline

#364 2021-01-30 17:49:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,081
Website GitHub Mastodon Twitter

Re: etc_query: all things Textpattern

Thanks so much Oleg,
I’ll install it and report if there are any issues.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#365 2021-05-16 19:20:01

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

Re: etc_query: all things Textpattern

Version 1.4 is released. Main news:

  • added ini markup, to import ini-formatted arrays;
  • added sort attribute, to order (flat) multi-dimensional arrays by one or several fields.

Offline

#366 2021-05-19 16:26:43

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

Re: etc_query: all things Textpattern

Version 1.5 is available. Main news:

  • empowered sort attribute for ordering multi-dimensional (sub-)arrays by several fields.
  • chainable markup attribute, to enable customizable mixed markups.

Example:

<txp:variable name="winners">
name=Alice
age=11
place=2
--
name=Bob
age=9
place=2
--
name=Cindy
age=10
place=1
</txp:variable>

<txp:etc_query data='<txp:variable name="winners" />'
    markup="list:--, ini"
    sort="[place|age<nat]"
    wraptag="ol" break="li"
>
    {name?} ({age?} years old)
</txp:etc_query>

outputs

  1. Cindy (10 years old)
  2. Bob (9 years old)
  3. Alice (11 years old)

Offline

#367 2021-06-15 14:44:44

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

Re: etc_query: all things Textpattern

Version 1.5.1 is CSV-import-able, thanks to Stef for a possible use case (wrap it into etc_cache if needed):

<txp:etc_query markup="csv" url=".../export?format=csv" wraptag="table">
{$doWrap($|tr|td)}
</txp:etc_query>

Offline

#368 2023-02-22 21:56:18

lazlo
Member
Registered: 2004-02-24
Posts: 110

Re: etc_query: all things Textpattern

Hey Oleg

I tried to install etc_query 1.5.8 as my first plugin on a completely a brand new 4.8.8 install.

I got this: “Badly formed or empty plugin code.” Sad Trumpet sounds …

Any advice here?

- Les

Offline

#369 2023-08-23 20:27:12

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

Re: etc_query: all things Textpattern

Indeed a very useful plugin, but now I am stuck with the task of reading very many XML files like this:

<?xml version="1.0" encoding="UTF-8"?>
<Image xmlns="http://schemas.microsoft.com/deepzoom/2008"
  Format="jpeg"
  Overlap="1"
  TileSize="256"
  >
  <Size 
    Height="71029"
    Width="62493"
  />
</Image>

The Size parameters are wanted, but no output is generated with this simple code:

<txp:etc_query  markup="xml" 
query="//Image/Size" url="https://example.com/A01.xml" >
Height={Height?}<br />
Width={Width?}<br />
</txp:etc_query>

No luck with smd_xml either. I wonder if it could be the XML syntax that prevents the size parameters from being extracted?

Offline

#370 2023-08-23 21:40:04

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

Re: etc_query: all things Textpattern

Two things:

  • Your root Image is namespaced, which bothers the parser. Try markup="xml:" (with : after xml).
  • Height and Width are attributes, thus requiring a corresponding syntax:
Height={@Height?}<br />
<!-- or simply -->
{@Width}<br />

Offline

#371 2023-08-24 05:28:01

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

Re: etc_query: all things Textpattern

Thanks so much. That did the trick!

Offline

#372 2024-10-24 13:06:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,081
Website GitHub Mastodon Twitter

Re: etc_query: all things Textpattern

I’m trying to get youtube thumbnails using the API.

For vimeo, it was:

<txp:etc_query url='https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/<txp:yield name="media" />' query="." markup="json">
   	<img src="{thumbnail_url?}" width="{thumbnail_width?}" height="{thumbnail_height?}" class="grid_24" alt="{description?}">
    		{description?}
</txp:etc_query>

I tried:

<txp:etc_query url='http://www.youtube.com/oembed?url=<txp:yield name="media" />' query="." markup="json">
   	<img src="{thumbnail_url?}" width="{thumbnail_width?}" height="{thumbnail_height?}" class="grid_24" alt="{description?}">
    		{description?}
</txp:etc_query>

Any help would be appreciated.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB