thomasfals Posted July 15, 2010 Share Posted July 15, 2010 The build up: I am a wordpress / php newbie so bare with me - I use the following to change classes on a menu element according to the category (this is one of many buttons) <a href="/category/presets/photoshop_actions" title="Only Photosshop Actions" <?php if (is_category(photoshop_actions) || is_single() && in_category('47')) { echo ' class="rounded rounded_active" ';} else{ echo ' class="rounded" ';} ?> > <span> Photoshop Actions </span> </a> As you can see I get the class rounded_active added if the category is 47. So far so good. The question: When I perform a search within this category I also want the class to be set to rounded_active. For this I guess I will have to parse the url that looks like this: http://localhost:8888/?cat=47&s=boats So how do I parse the url and store the cat id in a variable? That way I could use it in the if statement. Any help will be very welcome indeed Link to comment https://forums.phpfreaks.com/topic/207874-how-to-parse-url-for-search-query/ Share on other sites More sharing options...
AbraCadaver Posted July 15, 2010 Share Posted July 15, 2010 if(isset($_GET['cat'])) { $variable = $_GET['cat']; } Link to comment https://forums.phpfreaks.com/topic/207874-how-to-parse-url-for-search-query/#findComment-1086713 Share on other sites More sharing options...
thomasfals Posted July 16, 2010 Author Share Posted July 16, 2010 Thank you very much - just what I was looking for Link to comment https://forums.phpfreaks.com/topic/207874-how-to-parse-url-for-search-query/#findComment-1086895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.