Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-12-15 03:03:46

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

Question about txp:if_request

I want to check if specific custom fields are used in the url. For example the field “location”: https://www.domain.com/photos/?location=Tokyo

If one of these custom fields is in the url, do “this action”.

I now have this:

<txp:if_request name="location,period,artist,publisher,medium" type="name">this action</txp:if_request>

But this also gives “this action” when another custom field (“translator”) is in the url.

What am I doing wrong?


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

#2 2021-12-15 07:49:05

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Question about txp:if_request

If you need it in an article list context, try

<txp:if_article_list type="location,period,artist,publisher,medium">
...
</txp:if_article_list>

Offline

#3 2021-12-15 10:21:19

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

Re: Question about txp:if_request

etc wrote #332228:

If you need it in an article list context, try

<txp:if_article_list type="location,period,artist,publisher,medium">...

That solved it wonderfully! Why didn’t I think of that, I now wonder. Sometimes, one overthinks…

Thank you so much for both solutions!


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

Board footer

Powered by FluxBB