Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2010-03-08 18:16:57
- woof
- Member

- Registered: 2004-08-01
- Posts: 128
Re: soo_article_filter: additional control over article lists
Thanks Jeff
jsoo wrote:
The plugin could easily be modified to do this, but it wouldn’t help with your issue, because with this plugin you are still using
articleandarticle_customtags to fetch articles.
*penny drops* Oh yes. Of course – sorry.
However the plugin could change the article status from draft to live or sticky. Could you work with that?
I think so. I’m displaying just one article, the most recent (ie limit=1).
Normally this will show the most recent live article (I’m disregarding sticky status for these purposes)
Now I want to always display the most recent article regardless of whether its status is live or draft so if your plugin wrapping article_custom could achieve this then I think that’s a solution. The only drawback I can see is that its an all-or-nothing scenario — for example it wouldn’t be possible to hide display by setting status to hidden or pending.
Offline
Re: soo_article_filter: additional control over article lists
Yes it would. Haven’t really thought about the user-side implementation of this (i.e., what attributes to provide and how they would work), but e.g. the plugin could change status only for those articles currently “draft” (leaving “hidden” and “pending” untouched). Or some combination of status with category, author, or section.
Code is topiary
Offline
Re: soo_article_filter: additional control over article lists
Version 0.2.6 released. Two new attributes, update_set and update_where, which can be used in tandem to add a custom UPDATE query on soo_article_filter’s temporary `textpattern` table.
Example: change the status of all draft articles in the “News” section to live:
<txp:soo_article_filter update_set="Status=4" update_where="Status=1 AND Section='news'">
<txp:article_custom section="news" />
</txp:soo_article_filter>
Last edited by jsoo (2010-03-08 23:25:22)
Code is topiary
Offline
Re: soo_article_filter: additional control over article lists
Powerful!!!
Thank you!
Offline
#20 2010-03-09 00:29:51
- woof
- Member

- Registered: 2004-08-01
- Posts: 128
Re: soo_article_filter: additional control over article lists
works a treat – thank you
Offline
#21 2010-04-03 01:11:01
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: soo_article_filter: additional control over article lists
Hey Jeff
Can you tell me if your filter can directly implement this:
Sometimes you might want to sort names. If you have First and Last names in one field, seperated by a blank, you can do this by:
SELECT * FROM my_addressbook ORDER BY SUBSTRING_INDEX(custom_1, ‘ ‘, -1) ASC
This works with John Adam, John F. Adam
but not with John F.Adam
It may be handy for others as well who deal with merged data fields.
Hope you can help.
regards
Les Smith
Offline
Re: soo_article_filter: additional control over article lists
<txp:soo_article_filter update_set="custom_2=substring_index(custom_1,' ',-1)">
<txp:article sort="custom_2 asc" />
</txp:soo_article_filter>
substituting custom_2 with an unused custom field.
Code is topiary
Offline
#23 2010-04-03 01:58:01
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: soo_article_filter: additional control over article lists
Thanks Jeff.
This is totally useful for all types of calls.
Just to check that new custom_2 field is now permanent, I can call it elsewhere when needed or is it temporary?
Either way this is so rich.
Temporary as the manual says.
regards
Les Smith
Last edited by lazlo (2010-04-03 02:15:16)
Offline
Re: soo_article_filter: additional control over article lists
It may be handy for others as well who deal with merged data fields.
Yes indeed! I have an immediate use for this. Thank you to both of you.
TXP Builders – finely-crafted code, design and txp
Online
#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
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
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
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
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
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