Filtering by category from a detail page

3 posts by 3 authors in: Forums > CMS Builder
Last Post: May 15, 2015   (RSS)

By gkornbluth - May 15, 2015 - edited: May 15, 2015

Hi,

I can't tell from your description exactly how you are setting up searching the list, but here's a recipe with one approach from my CMSB Cookbook http://www.thecmsbcookbook.com

SEARCH FORM THAT GETS LABEL VALUES FROM A LIST FIELD

Instead of manually entering your search criteria, you can use this code to retrieve the label values from a list field
and automatically insert them into your search form. Possible values for your-criteria are listed below.



<form method="POST" action="<?php echo $_SERVER['PHP_SELF'?>">
<select name = "your_field_your-criteria" > 
<option value="">Please Choose a Category</option>
<?php foreach (getListOptions('your_table ''your_field') as $value => $label): ?> 
     
<option value = "<?php echo $value;?><?php selectedIf($value, @$_REQUEST['your_field']);?>>
    
<?php echo $label?></option> 
     
<?php endforeach ?> 
 
</select> 

<input type="submit" name="submit" value="Search" >
</form>
__


Search Criteria (your-criteria)

_match - an exact match    
_keyword - will look for specific words    
_prefix - starts with keyword (or letter)
_query - allows google-style query searches such as: +dog -cat "multi word phrase". Only records matching EVERY word or
quoted phrase are returned. Words or phrases that start with - mean "must not match". The + is optional and not
required. 
_fieldname_empty     Matches blank fields    Matches fields that are blank (""). Example: email_empty=1
_min - A minimum value for numeric searches
_max - A maximum value for numeric searches
_year     year number for date searches
_month - month number for date searches
_day - Day of month for date searches

Hope that helps.

If not, please post your list and detail page code so we can see exactly what you're doing.

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Damon - May 15, 2015

Hi,

Does the detail page content belong to the same category that you wan to filter the list with?

If so, you don't need to use a URL search query but can filter in the code.

Can you send me a link to the page as it is currently working and also the template so I can see the current code?

You can also send these details to me directly via support@interactivetools.com.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/