Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-07-02 15:48:42

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

[SOLVED] Do something when query string is a certain thing

Hi again!

I want to conditionally check whether a second part of query string is in play on a search URL and grab some info from it, for example on:

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

Basically, I want to capture the 4.7 (or whatever result it is) to a variable and use that in a search results page. The URL may not have that in it, such as:

http://www.textpattern-plugins.local/?q=cache

So I want it to be flexible enough to not blow up if that’s the case.

Any advice/examples?

Offline

#2 2020-07-02 16:01:41

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: [SOLVED] Do something when query string is a certain thing

Have you looked at adi_gps?

Offline

#3 2020-07-02 16:07:32

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: [SOLVED] Do something when query string is a certain thing

Thanks, but I’m looking for a core or pure PHP way, not via a plugin.

Offline

#4 2020-07-02 16:29:03

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: [SOLVED] Do something when query string is a certain thing

<txp:variable name="compatibility"><txp:page_url type="compatibility" /></txp:variable>

Source: Link to last published article

Offline

#5 2020-07-02 16:43:20

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: [SOLVED] Do something when query string is a certain thing

Yay that’s it! Thanks Michael. 👏👏👏

Offline

Board footer

Powered by FluxBB