Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-19 23:04:25

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Article custom search in custom fields

Hi,
I would like to list articles base on search terms from a URL parameter that will search for any match in specific custom fields contains that term please.

For example:
<txp:article_custom section="music" form="myform" title="{search term}" artist_name="{search term}" song_title="{search term}" />
Or better:
<txp:article_custom section="music" form="myform" search_term="example" search_fields="title,artist_name,song_title" />

What is the right syntax for doing this please?
or should I use PHP or a plugin? if so I would appreciate an example please.

Offline

#2 2020-12-20 13:01:12

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: Article custom search in custom fields

I found smd_query plugin to be useful for this as:

<txp:smd_query 
    form="myform" 
    column="*" 
    table="textpattern" 
    where="
        section='music' 
        AND concat(title,custom_1,custom_2) like '%search term%' 
        AND Status IN(4)
    "
/>

Last edited by THE BLUE DRAGON (2020-12-20 16:10:37)

Offline

#3 2020-12-20 15:35:44

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

Re: Article custom search in custom fields

I’d love to see the site you are working on. I wish I could help you with your queries, but they are admittedly well beyond my knowledge.


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

Offline

#4 2020-12-20 16:13:44

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: Article custom search in custom fields

colak wrote #327697:

I’d love to see the site you are working on. I wish I could help you with your queries, but they are admittedly well beyond my knowledge.

Thanks, I will publish it when finished, I’m learning a lot while developing it, so it is a slow progress but hopefully will finish soon :)

Offline

Board footer

Powered by FluxBB