Setting up a search page with search block and Pre-configured searches
7 posts by 3 authors in: Forums > CMS Builder
Last Post: July 20, 2012 (RSS)
By drewh01 - June 28, 2012
I had someone request that I set up a search page for a photo gallery section that I set up using a multi record with the following:
1.) Search block (similar to Google seach)
2.) Pre-configured searches [link only, no images on this page]--when clicked on, shows a page with thumbnails of images meeting our criteria. We will start off with 3 of these, but will add a few more in the future.
3.) Pre-configured searches, showing 5 thumbnails
* Latest 5 images added
* Editor's choices
Thoughts or comments on where to start? Any other info needed?
thanks!
drew
Re: [drewh01] Setting up a search page with search block and Pre-configured searches
By gkornbluth - June 30, 2012 - edited: June 30, 2012
Here's one of the recipes from my CMSB Cookbook thecmsbcookbook.com regarding setting up searches. It may be of help in getting you started.
Jerry Kornbluth
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
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Setting up a search page with search block and Pre-configured searches
By drewh01 - July 9, 2012
Is #3 possible?
Re: [drewh01] Setting up a search page with search block and Pre-configured searches
By gkornbluth - July 10, 2012
You might also use a check box for editors choices and use an if statement like <?php if ($record['editors_choice'] == 1 ): ?> to show only those records that are editors pics.
You can use a separate load records call for special situations.
Hope that set you in the right direction.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Setting up a search page with search block and Pre-configured searches
By drewh01 - July 19, 2012
I'm really new to using search functions but can usually figure something out if I have a example code page to follow.
Might I get something that I can model my code page off of? It would really help, thanks!
Here is a test page I am trying to set up:
http://www.hummingbirdsociety.org/photo-gallery-main.php
Here is my main list of photos with data:
http://www.hummingbirdsociety.org/photo-gallery-list.php
I have a "Featured Image" checkbox but forget how to get that large image upload to appear on the page.
I'm also having a problem trying to figure out how to get a general search set up on that page as well.
Re: [drewh01] Setting up a search page with search block and Pre-configured searches
By gkornbluth - July 20, 2012
If statements can probably do a lot of the heavy lifting for you. There are lots of code recipes in my CMSB cookbook. thecmsbcookbook.com
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [drewh01] Setting up a search page with search block and Pre-configured searches
By Jason - July 20, 2012
Do you only need the featured image record appear on the photo-gallery-main.php page? Can you attach your PHP code for us to take a look at?
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/