Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2010-04-03 19:54:50

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

Re: soo_article_filter: additional control over article lists

Hey Jeff

Another question that maybe you can help with.

I have the following fields:
Author_1
Author_2
Author_3
Editor_1
Editor_2
etc.

I want to merge/join/union into a temporary table (you choice on most appropriate) and then match against an existing author_1.
I was doing this individually but came up against matching null fields and having to have a function for every field.

So what I was doing

Does Author_1 match
Author_1

Does Author_1 match
Author_2

Does Author_1 match
Author_3

or for actual code:

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Author_1=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” limit=“50” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Author_2=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Author_3=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Editor_1=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Editor_2=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Translator_1=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Translator_2=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Photographer=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

<txp:asy_wondertag>
<txp:article_custom form=“book_title” Illustrator=”<txp:custom_field name=“Author_1” />”
section=“Books” sort=“custom_4 desc” />
</txp:asy_wondertag>

The above code kinda works except I can’t get it to ignore NULL entries so after I saw your plug-in I thought it might be easier to merge all those fields and do one function instead.
This is one reference I found that has brought me to you with this question, as it seems to be what you are doing with you plugin.
http://www.webmasterworld.com/forum112/60.htm

regards
Les Smith

Last edited by lazlo (2010-04-03 21:41:31)

Offline

#26 2010-04-03 21:41:14

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

Untested, but something like this might work:

Assign a custom field (as usual, in site prefs) to hold the merged fields. I’ll call the new field Credits, and assume it’s custom field #10.

<txp:soo_article_filter update_set="custom_10=concat_ws(';',custom_1,custom_2,custom_3,custom_4,custom_5)">
    <txp:article_custom Credits='%<txp:custom_field name="Author_1" />%' />
</txp:soo_article_filter>

adding as many custom fields as needed to Credits.

I am not using asy_wondertag because that was obviated by Txp version 4.0.7.


Code is topiary

Offline

#27 2010-07-11 13:27:49

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: soo_article_filter: additional control over article lists

I want to show articles where custom_7 is between 45 and 50. I “marked” this articles by setting “1” to custom field “type”:

<txp:soo_article_filter update_set="custom_14=1" update_where="custom_7 BETWEEN 44 AND 51">
	<txp:article_custom type="1" limit="3" form="quick_select_form" />
</txp:soo_article_filter>

Hope this can help somebody (or, Jeff, you can enhance your help with this example).


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#28 2010-07-11 14:44:26

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

Thanks Victor — clever way to extend the plugin’s functionality. And gives me a new feature idea :)


Code is topiary

Offline

#29 2010-07-11 15:54:27

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

Version 0.3.0 available.

New attribute: where, allows you to add a raw WHERE expression to the selection criteria. (Thanks Victor!)

Victor’s example, above, can now be done this way:

<txp:soo_article_filter where="custom_7 BETWEEN 44 AND 51">
	<txp:article_custom limit="3" form="quick_select_form" />
</txp:soo_article_filter>

so that the extra custom field isn’t required.


Code is topiary

Offline

#30 2010-07-11 19:33:50

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: soo_article_filter: additional control over article lists

Jeff – lack of this attr made me to use update in “strange” way :) Thanks for where attr – will update immediately.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#31 2010-12-09 16:50:08

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

Version 0.3.1 available.

Added limit, offset, and sort attributes.

If you are concerned about memory usage, these attributes give you more options for winnowing down the size of the temporary table. (Idea came out of this discussion.)


Code is topiary

Offline

#32 2011-01-03 23:44:51

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

Version 0.3.2 available.

Multidoc compatibility update.


Code is topiary

Offline

#33 2011-03-03 22:35:10

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: soo_article_filter: additional control over article lists

I really need to use txp’s default search in updated textpattern table. I even tried do disable this line if ( $pretext['q'] ) return parse($thing);, but without success. Is there any way to allow soo_article_filter to work with search? Why plugin disables at searchs?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#34 2011-03-04 01:21:48

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

I could be wrong but I don’t think fulltext search on a temporary table is possible.


Code is topiary

Offline

#35 2011-03-04 13:50:44

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_article_filter: additional control over article lists

I’m wrong; it is possible. But the index would have to be built separately for the temp table, as here.


Code is topiary

Offline

#36 2011-03-04 19:43:33

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: soo_article_filter: additional control over article lists

Just read this article :) Maybe it’s worth to add fulltext if search is defined?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

Board footer

Powered by FluxBB