Panels variant selection rules using query string in the URL I need a variant in Panels' selection rule of "String: URL path" to be related to the the query string of the URL:

Variant 1 - String: URL path = mypath/page?querystring=1

Variant 2 - String: URL path = mypath/page?querystring=2


Surprisingly I can't find a solution for this!
You can accomplish using query strings in panels if you use php code for your selection criteria.

Something along the lines of

$url_comp = explode('/', request_uri());
$desired = $url_comp[2];
check_plain($desired);
if ($desired == "page?querystring=1") {
return true;
}


will provide you with the access check on whether or not to show the panel variant. Check_plain may be called incorrectly in the code above but including some sort of check to make sure your querystring is clean would be very advantageous to prevent any sort of security issue.

You may need to adjust the position of your desired path above. url_comp[0] will return empty, url_comp[1] from your example above would return mypath and url_comp[2] would be page?querystring=1

I came up with the idea for this approach from the comments on https://api.drupal.org/comment/18449#comment-18449