Advanced Search

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 9, 2014   (RSS)

By meg - June 9, 2014

I'm looking to develop a more advanced search section for a client's website. I already have a very basic site search set up for this particular record, but I was wondering if you could guide me into the more advanced features. 

1. Displaying Search Results. I'm using this and getting undefined index errors for all of the field1, field2, etc (not the title and summary). Suggestions?

 $searchTables['directory'] = array(
    'viewerUrl'       => 'directory.php',
    'titleField'      => 'first_name',
    'summaryField'    => 'name',
'searchFields'    =>  array('first_name', 'name','title', 'institution', 'city', 'location'),
'field1'       => 'title',
'field2'       => 'institution',
'field3'       => 'city',
'field4'       => 'location',
    
  );

then to view the record lists

<?php foreach ($searchRows as $record): ?>
<h3><?php echo htmlspecialchars($record['_title']); ?> <?php echo htmlspecialchars($record['_summary']); ?></h3>
<p><em><?php echo htmlspecialchars($record['_field1']); ?></em><br />
<?php echo htmlspecialchars($record['_field2']); ?><br />
<?php echo htmlspecialchars($record['_field3']); ?>, <?php echo htmlspecialchars($record['_field4']); ?></p>
<h4><a href="<?php echo $record['_link'] ?>">Read more</a></h4>
<?php endforeach ?>

2. I need to create a custom search form (drawing from the database) to either: 

search by name OR search by state (dropdown menu) OR search by level (dropdown menu)

OR

search by state and level

Is this possible?

3. Hide Feature: I already set up a "hide button" that is either checked or unchecked in each record from this "directory" that the search results are drawing from. I need the search to hide any of the records that checked this box. 

4. Display search results in alphabetical order. Is this possible?

Please let me know what's possible...thank you!!