Textpattern Forum

You are not logged in. Register | Login | Help

#11 2012-05-02 16:18:07

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,066
Website

Re: etc_query: all the things

supremely useful.

Offline

#12 2012-05-02 21:53:31

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Supremely flattered!:) I was amazed by the many things one can do with xpath, hope it will be used. Thank you!


etc_[ query | search | pagination | date | tree | url ]

Offline

#13 2012-05-06 10:07:47

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Version 0.75: enables PHP functions in replace values.


etc_[ query | search | pagination | date | tree | url ]

Offline

#14 2012-05-09 17:45:57

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Version 8: now can also query databases, JSON objects and (even if it does not make much sense) serialized arrays.


etc_[ query | search | pagination | date | tree | url ]

Offline

#15 2012-05-22 11:51:17

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Version 0.87: enhanced special patterns with default values.


etc_[ query | search | pagination | date | tree | url ]

Offline

#16 2012-05-24 18:51:42

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Version 0.88: enhanced special patterns with sanitizer functions (many thanks to Gocom for alerting me). Dropped preparse attribute.


etc_[ query | search | pagination | date | tree | url ]

Offline

#17 2012-05-26 05:21:38

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 564
Website

Re: etc_query: all the things

Is there a way to do both numbered links and prev/next links in article_custom pagination? I’d like to use it for that, but thought I’d ask first.

Offline

#18 2012-05-26 10:43:43

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

maruchan wrote:

Is there a way to do both numbered links and prev/next links in article_custom pagination? I’d like to use it for that, but thought I’d ask first.

You mean prev/next page? With one query it is tricky (in the current version), since we have to display some nodes twice, with different attributes. But with two queries it is possible (takes less than 0.005 extra seconds).

Suppose the navigation is driven by some url variable, say pgc. We firstly create the pagination list and store it in some variable:

<txp:variable name="pgc_list">
<txp:etc_query
  data='<txp:article_custom limit="999"><a href=''<txp:permlink />''><txp:title /></a></txp:article_custom>'
  query="a[position() mod 10 = 1]"
>
<a href="?pgc={#row}">{#row}</a>
</txp:etc_query>
</txp:variable>

Then in the article form put

<txp:if_individual_article>
<txp:variable name="pgc_list" />
<txp:else />
<txp:etc_query
  data='<txp:variable name="pgc_list" />'
  query="a[{?pgc|1|intval}]"
  globals="_GET"
  replace="preceding-sibling::a[position()=1]=Previous;following-sibling::a[position()=1]=Next"
>
{preceding-sibling::a[position()=1]}
<txp:variable name="custom_list" />
{following-sibling::a[position()=1]}
</txp:etc_query>
</txp:if_individual_article>

The article form can be completed with current page articles, enhanced with first/last links, restricted to showing at most n page links, and so on Please feel free to experiment, I will be glad to help .


etc_[ query | search | pagination | date | tree | url ]

Offline

#19 2012-05-26 10:45:30

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,268
Website

Re: etc_query: all the things

Version 0.89: some minor (but annoying) bugfixes, please update.


etc_[ query | search | pagination | date | tree | url ]

Offline

#20 2012-05-26 17:28:01

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 564
Website

Re: etc_query: all the things

Thank you, I’m trying that code out now. I’m going to try to troubleshoot, but I’m getting this error. Any advice is appreciated.

Tag error: <txp:etc_query
  data='<txp:variable name="pgc_list" />'
  query="a[{?pgc|1|intval}]"
  globals="_GET"
  replace="preceding-sibling::a[position()=1]=Previous;following-sibling::a[position()=1]=Next"
> ->  Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given  on line 369
textpattern/lib/txplib_misc.php(653) : eval()'d code:369 DOMDocument->saveHTML()
textpattern/publish.php:1188 etc_query()
textpattern/publish.php:1113 processTags()
textpattern/publish/taghandlers.php:3219 parse()
textpattern/publish.php:1188 if_individual_article()
textpattern/publish.php:1113 processTags()
textpattern/lib/txplib_misc.php(653) : eval()'d code:42 parse()
textpattern/publish.php:1188 rah_output_section_form()
textpattern/publish.php:1100 processTags()
textpattern/lib/txplib_misc.php(653) : eval()'d code:18 parse()
Tag error: <txp:variable name="custom_list" /> ->  Notice: Undefined index:  custom_list  on line 4465
textpattern/publish.php:1188 variable()
textpattern/publish.php:1100 processTags()
textpattern/lib/txplib_misc.php(653) : eval()'d code:380 parse()
textpattern/publish.php:1188 etc_query()
textpattern/publish.php:1113 processTags()
textpattern/publish/taghandlers.php:3219 parse()
textpattern/publish.php:1188 if_individual_article()
textpattern/publish.php:1113 processTags()
textpattern/lib/txplib_misc.php(653) : eval()'d code:42 parse()
textpattern/publish.php:1188 rah_output_section_form()

Offline

Board footer

Powered by FluxBB