Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2021-07-07 06:50:50

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,520
Website GitHub

Re: How can I create article lists from custom fields?

Have you tried an article tag with match="Tokyo, Yokohama, Kyoto, etc" not to invert the results? Or maybe valueless exclude will flip things, can’t remember.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#26 2021-07-07 06:59:33

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

Bloke wrote #330907:

Have you tried an article tag with match="Tokyo, Yokohama, Kyoto, etc" not to invert the results? Or maybe valueless exclude will flip things, can’t remember.

But match checks the name of the custom field not its value, right? Or am I mistaken?

Anyway, I tried and get pagination but no articles.


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#27 2021-07-07 09:28:21

etc
Developer
Registered: 2010-11-11
Posts: 4,517
Website GitHub

Re: How can I create article lists from custom fields?

It’s more difficult than it should (and will) be. We have postponed these multi-match cases to cf branch.

Meanwhile, you can try

<txp:if_request type="get" name="location" value="other">
    <txp:php>$_GET['location'] = ['Tokyo', 'Kyoto'];</txp:php>
    <txp:variable name="exclude">
    <txp:article_custom fields="thisid" match="location" limit="999" break=",">
        <txp:article_id />
    </txp:article_custom>
    </txp:variable>
    <txp:article exclude id='<txp:variable name="exclude" />' />
<txp:else />
    <!-- normal workflow -->
</txp:if_request>

This will be more straightforward in txp 4.8.8.

Offline

#28 2021-07-07 09:34:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,520
Website GitHub

Re: How can I create article lists from custom fields?

Kjeld wrote #330908:

But match checks the name of the custom field not its value, right?

D’oh of course. Brain wasn’t switched on, sorry. Glad Oleg has a solution now, and some trickery up his digital sleeve for 4.8.8.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#29 2021-07-07 11:36:28

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

Bloke wrote #330912:

D’oh of course. Brain wasn’t switched on, sorry. Glad Oleg has a solution now, and some trickery up his digital sleeve for 4.8.8.

Thank you. I lost a lot of my confidence in my understanding of Textpattern after my off-brain event with match the other day. But if it even happens to you, I don’t need to worry.

I suspect you wrote this just to make me feel better 😉


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#30 2021-07-07 11:39:08

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

etc wrote #330910:

It’s more difficult than it should (and will) be. We have postponed these multi-match cases to cf branch.

Meanwhile, you can try

<txp:if_request type="get" name="location" value="other">...

This will be more straightforward in txp 4.8.8.

Oh, genius. And convoluted…

No wonder I couldn’t figure it out! Thinking something like this up is way beyond my ability.

What is the ETA of txp 4.8.8, Oleg?


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#31 2021-07-07 11:40:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,520
Website GitHub

Re: How can I create article lists from custom fields?

It happens with alarming regularity to me, haha. If I deleted all my ill-informed advice from the forum, I’d probably have a third fewer posts overall :)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#32 2021-07-07 11:42:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,520
Website GitHub

Re: How can I create article lists from custom fields?

We were slating 4.8.8 for November to coincide with the planned PHP 8.1 release, while we do some 4.9 work over the summer. But it might come forward if we have a sufficient feature set before then.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#33 2021-07-07 13:53:13

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

Bloke wrote #330917:

It happens with alarming regularity to me, haha. If I deleted all my ill-informed advice from the forum, I’d probably have a third fewer posts overall :)

I think you are doing fine! You have been a tremendous help more times than I can remember.

Bloke wrote #330918:

We were slating 4.8.8 for November to coincide with the planned PHP 8.1 release, while we do some 4.9 work over the summer. But it might come forward if we have a sufficient feature set before then.

Oh, that sounds great. I may just wait with the Other option until 4.8.8 comes out, then. Much better to do it with something that is part of the core.


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#34 2021-07-07 15:09:13

etc
Developer
Registered: 2010-11-11
Posts: 4,517
Website GitHub

Re: How can I create article lists from custom fields?

FWIW, the main question is how to transform a string into multiple values array. The standard txp separator (i.e. comma) is fine for cf names, but not for their values. For example, if location="Tokyo, Kyoto" can be considered as location="Tokyo" OR location="Kyoto", the same logic would fail for movie="Paris, Texas".

In cf branch, separators will be part of cf definitions, so this ambiguity will be gone. Meanwhile, even in 4.8.8 you’ll need to cheat, I’m afraid.

Offline

#35 2021-07-07 15:20:13

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

etc wrote #330921:

FWIW, the main question is how to transform a string into multiple values array. The standard txp separator (i.e. comma) is fine for cf names, but not for their values. For example, if location="Tokyo, Kyoto" can be considered as location="Tokyo" OR location="Kyoto", the same logic would fail for movie="Paris, Texas".

In cf branch, separators will be part of cf definitions, so this ambiguity will be gone. Meanwhile, even in 4.8.8 you’ll need to cheat, I’m afraid.

Thanks for the additional explanation, Oleg!


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#36 2021-07-07 15:42:33

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 379
Website

Re: How can I create article lists from custom fields?

Oleg, if separators will be part of cf definitions, will it be possible to add the term Other to a city name (eg.: “Other,Okayama” if the separator is a comma, or perhaps “Other|Okayama” or “Other:Okayama” if the separator is a vertical slash or colon) and still have that article appear in the results of https://www.oldphotosjapan.com/photos/?location=Other?

If so, I would only need to remove “Other,” (or “Other|” or “Other:”) from the string when displaying the city name in the article.

It would be a much more elegant solution.

Last edited by Kjeld (2021-07-07 15:45:02)


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

Board footer

Powered by FluxBB