Search Code

6 posts by 2 authors in: Forums > CMS Builder
Last Post: May 27, 2015   (RSS)

I need my search to allow you to search part of the keyword: Here is the input field:

<form method="POST" action="search.php" class="searchForm">
<input name="name" type="text" class="search-field" id="search" value="search" onfocus="if(this.value == 'search') { this.value = ''; }" /></form>

If my name is' port hope', if I only search 'port', I get no results. How can it search any part of the word?

Search.php page code.

<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

// load viewer library
$libraryPath = 'cmsb/lib/viewer_functions.php';
$dirsToCheck = array('/home/plazacorp/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }


// load records from 'properties'
list($propertiesRecords, $propertiesMetaData) = getRecords(array(
'tableName' => 'properties',
'loadUploads' => true,
'allowSearch' => true,
));

?>

By Damon - February 19, 2015

Try changing this code:

<input name="name" type="text" class="search-field" id="search" value="search" onfocus="if(this.value == 'search') { this.value = ''; }" /></form>

To this:

<input name="name_keyword" type="text" class="search-field" id="search" value="search" onfocus="if(this.value == 'search') { this.value = ''; }" /></form>

Here is a link to more search field options:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

Let me know if this gets the results you are after.

Cheers,
Damon Edis - interactivetools.com

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

By dccreatives - May 27, 2015

Can I search more than one field? Right now it searches the name field, but I want it to show results for more than just that one field.

By dccreatives - May 27, 2015

I meant in the input field of the form action

By Damon - May 27, 2015

Hi again,

Try this:

<input type="text" name="title,summary,content_keyword" value="">

Let me know if this is works for you.

Cheers,
Damon Edis - interactivetools.com

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