Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#145 2012-10-27 21:05:04

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

Re: etc_query: all things Textpattern

It takes more than 3s to load for me (~4.7s), so your timeout must be still reached. Have you put your site in debug mode, maybe file_get_contents complains about something?

Offline

#146 2012-10-27 21:09:49

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

Txp debug trace:

<txp:etc_query url="ftp://ftp2.bom.gov.au/anon/gen/fwo/IDT16090.xml"
  markup="xml" debug="d" 
  query="//area"
  wraptag="ul" break="li">
	[<txp:etc_query url="ftp://ftp2.bom.gov.au/anon/gen/fwo/IDT16090.xml"
  markup="xml" debug="d" 
  query="//area"
  wraptag="ul" break="li">: false]
	[<txp:etc_query url="ftp://ftp2.bom.gov.au/anon/gen/fwo/IDT16090.xml"
  markup="xml" debug="d" 
  query="//area"
  wraptag="ul" break="li">: true]
</txp:etc_query>
[ ~~~ secondpass ~~~ ]
 -->

Offline

#147 2012-10-27 21:17:47

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

Re: etc_query: all things Textpattern

Could you try to import it with smd_xml, chances are it will do the job fine?

Offline

#148 2012-10-27 21:24:40

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

Good thinking. As smd_xml outputs nothing on the FTP XML, but outputs fine with a known HTTP XML feed, I guess it’s my environment – not the plugins?

Have checked obvious PHP config (execution time limit, etc) but I don’t know much about servers.

Offline

#149 2012-10-27 21:35:02

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

Re: etc_query: all things Textpattern

It works on my server, so that must be some config issue, but we need an advice of txp:gods here. I have tried every google-found thing to change file_get_contents timeout, with no visible success. Stef uses curl, so I hoped it will work and give us a clue, but it does not import ftp(?). Well, have to test curl, but since I can not reproduce this issue on my server, it might take some time, sorry.

Offline

#150 2012-10-27 21:58:31

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

Should have tried this earlier. I saved the XML file from the FTP server to my own site and accessed it as HTTP. Worked fine, and fast!

Loaded in 0.015221118927002 seconds. 

Processed in 0.0038979053497314 seconds.

Just for reference, the etc_query was:

<txp:etc_query url="http://mywebsite.net/dump/IDN11060.xml"
  markup="xml" debug="d" 
  query="//area"
  wraptag="ul" break="li">
{@description?}: {forecast-period[1]/text[@type="precis"]?}
</txp:etc_query>

So – the possibility of timeout causing the error is still there but at least I know my environment can open & process that file.

Last edited by nardo (2012-10-27 21:59:40)

Offline

#151 2012-10-28 10:45:01

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

Re: etc_query: all things Textpattern

nardo, have you imported it with the browser first, or directly on the server?

I think the plugins can be acquitted, they simply respect the servers settings. To be sure, you can test whether

<txp:php>var_dump(file_get_contents('ftp://ftp2.bom.gov.au/anon/gen/fwo/IDT16090.xml'));</txp:php>

returns something. I have shouted for help, hope we’ll work it out.

Offline

#152 2012-11-14 00:53:08

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

Oleg – could you give us an example of processing node content, sorting and then displaying top 5 or 10 – ?

The plugin help talks about XSL transforms and PHP functions.

Offline

#153 2012-11-14 10:32:24

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

Re: etc_query: all things Textpattern

Hi nardo, maybe this page will get you started?

Offline

#154 2013-01-07 01:08:27

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

Is it possible to use Txp variables in the query string?

We have a set of four variables in a Textpattern form, which is output on the page above the etc_query tag. We would like to use each of these four variables within the query. (They filter a JSON feed based on location.)

Thanks Oleg.

Offline

#155 2013-01-07 10:30:20

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

Re: etc_query: all things Textpattern

Hi nardo,

nardo wrote:

Is it possible to use Txp variables in the query string?

As for each tag, etc_query attributes are firstly processed by txp, so yes, you can normally use <txp:variable /> and other txp tags therein. Something like this works ok:

<txp:variable name="par" value="2" />

<txp:etc_query data="<p>one</p><p>two</p>" query='p[<txp:variable name="par" />]' />
or
<txp:etc_query data="<p>one</p><p>two</p>" query="p[{?par}]" />

Offline

#156 2013-01-07 11:02:11

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: etc_query: all things Textpattern

thank you!

Offline

Board footer

Powered by FluxBB