How do I query a string, with a wildcard on the end?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

How do I query a string, with a wildcard on the end?

Post by simonmlewis »

Code: Select all

$urlshop = $_SERVER['REQUEST_URI'];
if ($urlshop <> "/shop/")
{
echo "<div class='woocommerce-category-description'>
    <div class='description'>$term_object->description</div>
</div>";
}
This is working for us, so that if they are on a shop page, it doesn't show this DIV. But on the Categories, it does.
However, if the shop pages is : /shop/?min_price=1&max_price=2550
Then it fails.

So how do I put a wildcard on the end, so that anything "/shop/*" for example, disables the DIV?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How do I query a string, with a wildcard on the end?

Post by requinix »

Take a look at everything in $_SERVER and see if one of the values looks like the sort of string you want.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: How do I query a string, with a wildcard on the end?

Post by simonmlewis »

Did it thru pregmatch. Shouldn't be other pages with that it in.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply