Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2019-04-18 12:15:56

etc
Developer
Registered: 2010-11-11
Posts: 3,267
Website

Re: Can I narrow searches to only articles with certain tags?

philwareham wrote #317682:

If my custom field (called target) was say filled with:

4.7, 4.6, 4.5...

Then would that work somehow?

Yes, but you’d need to eventually add 4.8 etc when released. For every working plugin…


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

Offline

#12 2019-04-18 12:23:39

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,197
Website

Re: Can I narrow searches to only articles with certain tags?

Oh, of course ? – but then again plugins would need to be individually verified against new Textpattern releases anyway so maybe that isn’t such a big problem.

The best route would be to do as you suggest though, and assume plugins are compatible with new releases unless we tag them as not compatible. Less work to maintain.

I think it’s pretty important that the new plugins site lists a plugin’s compatibility and searches can be filtered by Textpattern version you are using.

Not sure how to proceed. This is proving more complex that I had originally thought!

A lot of this transfers to the planned themes website too, as the plugins and themes sites share a lot of common code.

Offline

#13 2019-04-18 12:33:26

etc
Developer
Registered: 2010-11-11
Posts: 3,267
Website

Re: Can I narrow searches to only articles with certain tags?

In some plugins I use 4.5..4.7 to say “between 4.5 and 4.7”. I don’t think someone ever needs to search for .. in a custom field, so we could adopt it in core. In your case we could use min-version and max-version cf and transform target=4.6 query into

min-version='..<txp:page_url type="target" />'
    max-version='<txp:page_url type="target" />..'

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

Offline

#14 2019-04-18 12:47:09

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,197
Website

Re: Can I narrow searches to only articles with certain tags?

Ok that sounds good. And if max-version is blank then it assumes that plugin is still compatible (no max version limit).

Offline

#15 2019-04-18 13:40:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,317
Website

Re: Can I narrow searches to only articles with certain tags?

What happens if somebody has an older install? Will links to previous versions of plugins be available?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#16 2019-04-18 14:09:21

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,197
Website

Re: Can I narrow searches to only articles with certain tags?

colak wrote #317688:

What happens if somebody has an older install? Will links to previous versions of plugins be available?

Hopefully, yes. Not got that far into the developments yet but should be.

Offline

#17 2019-06-10 21:16:46

etc
Developer
Registered: 2010-11-11
Posts: 3,267
Website

Re: Can I narrow searches to only articles with certain tags?

etc wrote #317685:

In some plugins I use 4.5..4.7 to say “between 4.5 and 4.7”.

Now in dev you can try 4.5%%4.7 (between 4.5 and 4.7) or 4.5%% (since 4.5). The double percent %% syntax is otherwise useless in db LIKE queries anyway.


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

Offline

#18 2019-06-25 14:54:24

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,197
Website

Re: Can I narrow searches to only articles with certain tags?

Hi, I’m back to looking at this now. So, where I’m at:

I’ve created a custom field called compatibility and for each article I’ll use your suggested values such as 4.5%% and 4.5%%4.7 as mentioned above (I’m using Textpattern 4.8-dev).

I need two uses for this custom field entry:

Use 1

To display a list of Textpattern versions that an article (plugin) is compatible with. The version numbers are stored in a file-type category list for ease of reference and not assigned to the article directly. So I could list them like so…

<txp:category_list type="file" parent="txp-version" exclude="txp-version" sort="name desc" break=",">
    <span class="compatibility"><txp:category title /></span>
</txp:category_list>

…which would obviously list all the catagories at the moment, which are 4.4, 4.5, 4.6 and 4.7.

So I need a way to only show certain categories from that list if the article’s compatibility custom field is set to 4.6%% or 4.4%%4.5 or 4.7 or whatever. Can you show me some code that can do that filtering?

Use 2

As per my original topic. I need to show, in search results, articles based on what their compatibility custom field is set to. For example, the plugin article ‘etc_cache’ has it’s compatibility custom field set to 4.6%% (since 4.6) so I’d expect the following query to definitely give a search result, but it doesn’t:

bc.
http://www.textpattern-plugins.local/?q=etc_cache&compatibility=4.7

Here’s the article list tag I’m using in search results, that I have tried to decipher from Oleg’s code suggestions so far:

<txp:article compatibility='<txp:page_url type="compatibility" wraptag="%" />' searchform="article_listing" limit="12" />

I assume something is wrong in there?

Sorry, I’ve tried to explain this as best I can! Any help greatly appreciated.

Offline

#19 2019-06-25 17:10:21

etc
Developer
Registered: 2010-11-11
Posts: 3,267
Website

Re: Can I narrow searches to only articles with certain tags?

Hi Phil,

the double percent %% is not meant to be used in custom fields values but as <txp:article /> filters. For example, if an article’s something cf is set to 4.6, then this article could be retrieved with

<txp:article something="4.4%%4.7" />
<!-- or -->
<txp:article something="4.5%%" />

Now, in plugins site case, we could use two custom fields, say min and max, to store the minimal and the maximal txp versions compatible with a given plugin (article). Say, for etc_cache that would be 4.6 and (currently) 4.7.3.

So, instead of displaying a list of txp versions (categories) compatible with a given plugin, you would display the min and the max versions.

Inversely, to search for all plugns compatibles with a given txp version, you could then try

<txp:article min='%%<txp:page_url type="compatibility" />'
    max='<txp:page_url type="compatibility" />%%' />

The main inconvenience is the necessity to set max value for each article and eventually modify it when a new txp version is released, but, as you say, we’ll have to check plugins compatibility anyway.


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

Offline

Board footer

Powered by FluxBB