Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
Online
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 valuelessexclude
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.
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline
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
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
Online
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 😉
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline
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?
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline
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
Online
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
Online
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.
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline
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
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 aslocation="Tokyo" OR location="Kyoto"
, the same logic would fail formovie="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!
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline
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)
• Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
• MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
Offline