View Single Post
Old May 13th, 2011, 08:11 AM
trymv trymv is offline
Join Date: Sep 2010
Posts: 47
Default Several name based filters simultaneously


I am trying to develop the opportunity to use several word based filters or several name based filters.

I started with the following brilliant forum post and then added some too it:

The above mentioned forum post explains, among other things, how to display a
[X] Remove filter when a filter is already active. I have used the code from there to make my own color filter, but I have several filters that use name as a parameter, and I would like to be able to use them both at the same time.

The code at the bottom is copied from the above mentioned forum post and then extended to see which filter is actually in use. Now if I have two different filters using name as the parameters, it will allow me to display [X] Remove color filter under the appropriate filter.

Now if the color parameter is already chosen and I would like to use a name based shape filter in addition to that, it will just overwrite the color choice. I would like for the filter to remember the color choice and simply append the query with the shape.

I.e. in stead of going from ?name=Blue to ?name=square, I would like for it to go from ?name=Blue to ?name=Blue+square

This could be achieved if I could enter a variable in the following line in stead of a constant:
<li><a href="[server.url type='fullpage' query='name=Blue']">Blue</a></li>

I.e. something like
<li><a href="[server.url type='fullpage' query='name=$color+blue']">Blue</a></li>

Is there is a way around this, I would be very grateful to hear about it. Any help is appreciated.

My code is posted below:

<?php if (substr_count(@$_GET['name'],'Blue') ||
substr_count(@$_GET['name'],'Black') ||
substr_count(@$_GET['name'],'Pink')){ ?>

<li><a href="[server.url type='fullpage' query='-name']">[X] Remove color filter</a></li>

<?php } else {

<li><a href="[server.url type='fullpage' query='name=Blue']">Blue</a></li>
<li><a href="[server.url type='fullpage' query='name=Black']">Black</a></li>
<li><a href="[server.url type='fullpage' query='name=Pink']">Pink</a></li>

<?php }