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: 416
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?


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

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

etc
Developer
Registered: 2010-11-11
Posts: 4,586
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: 416
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!


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